3

I need to check if several .exe files are running or not (which are installed by setup) and then prompt user to close them if they are running and if not cancel the uninstall process.

Is there any way to have something like Prepare page in install for uninstaller?

enter image description here

Or How can I implement such checking? Even a message box would be perfect also.

Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992
Inside Man
  • 4,194
  • 12
  • 59
  • 119

1 Answers1

2

If it is your application, make it create a mutex. Then you can use AppMutex directive, which works even for uninstaller.

[Setup]
AppMutex=MyProgMutex

enter image description here


If you cannot modify the application, you need to code the check for running application in Inno Setup. You can for example use IsAppRunning function from the answer by @RRUZ to How to check with Inno Setup, if a process is running at a Windows 2008 R2 64bit? in InitializeUninstall event function.

function InitializeUninstall(): Boolean;
var
  Message: string;
begin
  while IsAppRunning('MyProg.exe') do
  begin
    Message := 'The program is running, please close it';
    if MsgBox(Message, mbError, MB_OKCANCEL) = IDCANCEL then
    begin
      Result := False
      Exit;
    end;
  end;
  Result := True;
end;

enter image description here


For a similar question on installer, see:
Is it possible to check if program is already running before trying to install it? (Inno Setup)

Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992