卸载失败,因为程序正在运行.在尝试删除之前,如何使Inno Setup检查正在运行的进程? [英] Uninstall fails because program is running. How do I make Inno Setup check for running process prior to attempting delete?
问题描述
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检测在任何用户会话中运行的实例
有几种方法.如果您的程序定义了互斥锁,请使用
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 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