【问题标题】:Preparing to Uninstall like Preparing to Install Page - Inno Setup准备卸载就像准备安装页面一样 - Inno Setup
【发布时间】:2020-09-20 14:54:25
【问题描述】:

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

有没有办法在安装中为卸载程序提供准备页面之类的东西?

或者我怎样才能实现这样的检查?即使是消息框也很完美。

【问题讨论】:

    标签: inno-setup


    【解决方案1】:

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

    [Setup]
    AppMutex=MyProgMutex
    


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

    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;
    


    有关安装程序的类似问题,请参阅:
    Is it possible to check if program is already running before trying to install it? (Inno Setup)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多