1
votes

How can I check for a mutex in Inno Setup? I want my installer to wait if a Windows Installer installation is running.

I've only found the AppMutex Directive in Inno Setup but this does not exactly what I want.

2

2 Answers

3
votes

Use the CheckForMutexes function from the InitializeSetup event function.

[Code]

function InitializeSetup(): Boolean;
begin
  while CheckForMutexes('_MSIExecute') do
  begin
    MsgBox('Windows Installer Installation is running', mbError, MB_OK);
  end;

  Result := True;
end;

Assuming (based on the deleted answer by @ChristopherPainter) that the _MSIExecute is the mutex to check for.

0
votes

You can use the SetupMutex directive in the [Setup] Section

[Setup]

SetupMutex=MySetupsMutexName,Global\MySetupsMutexName

Edit:

But it only checks for the instances of the same installer with the same mutex name