Поскольку программа установки Inno 5.5.6 вы можете использовать SetupMutex
директиву:
[Setup]
AppId=MyProgram
SetupMutex=SetupMutex{#SetupSetting("AppId")}
Если вы хотите изменить текст сообщения, который отображает, когда другой установщик работает уже, использование:
[Messages]
SetupAppRunningError=Setup has detected that %1 is currently running.%n%nPlease close all instances of it now, then click OK to continue, or Cancel to exit.
До этой версии, не было встроенного механизма доступны. Но вы могли бы написать свой собственный довольно просто. Принцип заключается в том, что при запуске установки вы создаете уникальный мьютекс. Но, как только вы проверяете, нет ли уже существующего мьютекса. Если да, то выхода из режима настройки, если нет, то вы создаете семафор:
[Setup]
AppName=My Program
AppVersion=1.5
DefaultDirName={pf}\My Program
[Code]
const
// this needs to be system-wide unique name of the mutex (up to MAX_PATH long),
// there is a discussion on this topic http://stackoverflow.com/q/464253/960757
// you can expand here e.g. the AppId directive and add it some 'salt'
MySetupMutex = 'My Program Setup 2336BF63-DF20-445F-AAE6-70FD7E2CE1CF';
function InitializeSetup: Boolean;
begin
// allow the setup to run only if there is no thread owning our mutex (in other
// words it means, there's no other instance of this process running), so allow
// the setup if there is no such mutex (there is no other instance)
Result := not CheckForMutexes(MySetupMutex);
// if this is the only instance of the setup, create our mutex
if Result then
CreateMutex(MySetupMutex)
// otherwise tell the user the setup will exit
else
MsgBox('Another instance is running. Setup will exit.', mbError, MB_OK);
end;
Я не в курсе каких-либо директивы, которая позволила бы только один экземпляр установки (я предполагаю, что на 'AppId'). Жаль, что 'CreateMutex' не возвращает ничего полезного; здесь ['обходной путь'] (http://pastebin.com/sGcrC3pY) для него. Но это была бы хорошая встроенная функция. – TLama
Плюс один для ностальгии. Я даже не знал, что установка Inno все еще есть. – Lee
@ Lee, я [трачу свое время] (http://i.imgur.com/INfeUYD.jpg) здесь :-) – TLama