准备卸载,如准备安装页面 - Inno Setup

问题描述 投票:2回答:1

我需要检查几个.exe文件是否正在运行(由安装程序安装)然后提示用户在运行时关闭它们,如果没有取消卸载过程。

有没有办法在安装中为卸载程序安装准备页面?

enter image description here

或者我如何实施此类检查?即使是消息框也是完美的。

inno-setup
1个回答
1
投票

如果是您的应用程序,请创建一个互斥锁。然后你可以使用AppMutex directive,它甚至可以用于卸载程序。

[Setup]
AppMutex=MyProgMutex

enter image description here


如果无法修改应用程序,则需要在Inno Setup中对运行应用程序的检查进行编码。例如,您可以使用@RRUZ的答案中的IsAppRunning函数到How to check with Inno Setup, if a process is running at a Windows 2008 R2 64bit?中的InitializeUninstall event function

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

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.