由于程序正在运行,卸载失败。如何让 Inno Setup 在尝试删除之前检查正在运行的进程?
Inno Setup 在卸载过程中无法删除组件,因为我的程序仍在运行并且可执行文件无法删除。在允许卸载继续之前,如何让它检查它是否正在运行?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
Inno Setup 在卸载过程中无法删除组件,因为我的程序仍在运行并且可执行文件无法删除。在允许卸载继续之前,如何让它检查它是否正在运行?
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(5)
检查这些
Inno Setup:使用 AppMutex 检测在任何用户会话中运行的实例
Inno 设置:应用程序正在运行吗?
Inno 设置:检测应用程序是否正在运行
有多种方法。如果您的程序定义了互斥体
,或者在代码部分中指定了互斥体,
您还可以使用
类名来获取窗口句柄并向其发送消息。
或者通过名称获取它
或者您针对此特定用例使用多个 DLL 文件之一
或者阅读后自己做
如何在 Win32 中“干净地”终止应用程序
如何使用 Win32 API 枚举应用程序(此链接到德语版本,因为某种原因我找不到 KB175030 的英文版本,
或者尝试谷歌翻译版本KB175030-DE
KB175030 德国 -> EN
Check these
Inno Setup: Detect instances running in any user session with AppMutex
Inno Setup: Is application running?
Inno Setup: Detect if an application is running
There are several ways. If your program defines a mutex use
or for a specified mutex in the
Code
sectionYou could also use
to get the window handle by class name and send it messages.
Or get it by the name
Or you use one of several DLL files for this specific use case
Or do it yourself after reading
How To Terminate an Application "Cleanly" in Win32
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
or try the google translated version of the KB175030-DE
KB175030 DE -> EN
我们使用了上述以外的其他方法。因为这是卸载,所以我们可以终止该应用程序并卸载它。
最简单的方法,当你不能使用 AppMutex 时:(与 真正杀死进程有关Windows)
希望有人能提供帮助。我为此寻找了很长时间。
We used an other way than described above. Because this is an uninstallation we can kill the application and unistall it.
The simpliest way, when u can't use AppMutex: (related to Really killing a process in Windows)
Hope somebody will help this. I searched a long time for this.
尝试这个解决方案!我在关闭应用程序时遇到了其他解决方案的问题,但 Inno Setup 仍然认为已安装的文件已被锁定。
请记住定义您的常量:
主要支持此解决方案的原始来源< /a>.
Try this solution! I had issues with other solutions closing the app, but Inno Setup still thought the installed files were locked.
Remember to define your constants:
Major props to the original source of this solution.
使用
AppMutex
指令 阻止卸载程序当应用程序运行时继续进行。应用程序必须创建指令指定的互斥锁。有关示例,请参阅链接的 AppMutex 指令文档。
如果您想让卸载程序终止应用程序,请在应用程序仍在运行时使用以下代码:
与上面的
AppMutex
指令一样,应用程序必须创建CheckForMutexes
调用。请注意,对于安装程序,您不必编写此代码。安装程序内置重启管理器。
请参阅在 Inno Setup 中使用“taskkill /f /im”在(重新)安装之前终止进程。
Use the
AppMutex
directive to prevent the uninstaller from proceeding, when an application is running.The application has to create the mutex specified by the directive. See the linked
AppMutex
directive documentation for examples.If you want to have the uninstaller kill the application, when it is still running, use this code instead:
As with the
AppMutex
directive above, the application has to create the mutex specified in theCheckForMutexes
call.Note that for installer, you do not have to code this. The installer has restart manager built-in.
See Kill process before (re)install using "taskkill /f /im" in Inno Setup.
也许添加此属性
CloseApplications=yes
它将查看所有 [Files] 和 [InstallDelete] 元素,并使用 Windows 重新启动管理器
https://jrsoftware.org/ishelp/index.php?topic=setup_closeapplications
perhaps add this property
CloseApplications=yes
it will look at all the [Files] and [InstallDelete] elements and work using windows restart manager
https://jrsoftware.org/ishelp/index.php?topic=setup_closeapplications