准备卸载就像准备安装页面-Inno Setup [英] Preparing to Uninstall like Preparing to Install Page - Inno Setup

查看:158
本文介绍了准备卸载就像准备安装页面-Inno Setup的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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?

或者如何实施此类检查?甚至一个消息框也将是完美的.

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

推荐答案

如果它是您的应用程序,请使其创建互斥体.然后,您可以使用 AppMutex指令,该指令甚至适用于卸载程序. /p>

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

[Setup]
AppMutex=MyProgMutex

如果无法修改应用程序,则需要在Inno Setup中编写对运行应用程序的检查的代码.例如,您可以在@RRUZ的答案中使用IsAppRunning函数到如何使用Inno Setup进行检查(如果进程正在运行). Windows 2008 R2 64位? /a>.

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;

有关安装程序的类似问题,请参见:
是否可以在尝试安装程序之前检查程序是否已经在运行? (创新设置)

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

这篇关于准备卸载就像准备安装页面-Inno Setup的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆