...
Code: Select all
[Setup]
...
AppMutex=MediaMonkeyCode: Select all
[Code]
// Create a constant for the installer
const installer_mutex_name = 'mediamonkey_setup_mutex';
...
function InitializeSetup(): Boolean;
begin
// Create a mutex for the installer and if it's already running then expose a message and stop installation
Result := True;
if CheckForMutexes(installer_mutex_name) then begin
if not WizardSilent() then
MsgBox(ExpandConstant('{cm:SetupIsRunningWarningInstall,MediaMonkey}'), mbError, MB_OK);
Result := False;
end
else begin
CreateMutex(installer_mutex_name);
end;
end;
...
function InitializeUninstall(): Boolean;
begin
Result := True;
if CheckForMutexes(installer_mutex_name) then begin
if not WizardSilent() then
MsgBox(ExpandConstant('{cm:SetupIsRunningWarningUninstall,MediaMonkey}'), mbError, MB_OK);
Result := False;
end
else begin
CreateMutex(installer_mutex_name);
end;
end;
[CustomMessages]
en.SetupIsRunningWarningInstall=%1`s setup is already running!
en.SetupIsRunningWarningUninstall=%1`s setup is already running!