Marco Rebsamen
Marco Rebsamen

Reputation: 605

Inno Setup Check additional (Windows Installer) mutex

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.

Upvotes: 1

Views: 1082

Answers (2)

Martin Prikryl
Martin Prikryl

Reputation: 202474

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.

Upvotes: 3

Dennis Meissel
Dennis Meissel

Reputation: 2503

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

Upvotes: 0

Related Questions