卸载失败,因为程序正在运行.在尝试删除之前,如何使Inno Setup检查正在运行的进程? [英] Uninstall fails because program is running. How do I make Inno Setup check for running process prior to attempting delete?

查看:269
本文介绍了卸载失败,因为程序正在运行.在尝试删除之前,如何使Inno Setup检查正在运行的进程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Inno Setup无法在卸载过程中删除组件,原因是我的程序仍在运行并且无法删除可执行文件.在允许卸载继续之前,我如何检查它是否正在运行?

Inno Setup fails to remove components during uninstall cause my program is still running and the executable cannot be deleted. How do I have it check to see if it is running before allowing uninstall to proceed?

推荐答案

选中这些

Inno设置:使用AppMutex检测在任何用户会话中运行的实例

Inno设置:应用程序正在运行吗?

Inno设置:检测应用程序是否正在运行

有几种方法.如果您的程序定义了互斥锁,请使用

There are several ways. If your program defines a mutex use

[Setup]
AppMutex=MyMutexName

Code部分中指定的互斥锁

function CheckForMutexes (Mutexes: String): Boolean;

您也可以使用

function FindWindowByClassName (const ClassName: String): Longint; 

通过类名获取窗口句柄并向其发送消息.

to get the window handle by class name and send it messages.

或通过名称获取

function FindWindowByWindowName (const WindowName: String): Longint;

或者针对此特定用例使用几个DLL文件之一

Or you use one of several DLL files for this specific use case

  • PSVince
  • FindProcDLL

或者阅读后自己做

如何在Win32中干净"地终止应用程序

如何使用Win32 API枚举应用程序(该链接到德语版本为由于某种原因,我找不到英文版本的KB175030

How To Enumerate Applications Using Win32 APIs (this one links to the german version as for some reason I can't find the english version of KB175030

或尝试Google翻译的版本KB175030-DE

or try the google translated version of the KB175030-DE

查看全文

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