在尝试复制文件之前终止进程
我正在开发一个 NSIS 安装程序,以更新在后台运行的程序。显然,我想发送程序终止信号,因为否则我会反复收到“无法写入”错误。如何在安装程序大小的开销有限的情况下做到这一点?
I'm developing an NSIS installer, to update a program that runs in background. Obviously, I'd like to send the program termination signals, because otherwise I repeatedly get a "can't write" error. How can I do this, with a limited overhead on installer size?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您的应用程序有一个具有唯一类名的窗口,您可以只向其发送 WM_CLOSE/WM_QUIT 或您需要的任何消息。
或者您的应用程序可以注册卸载程序可以调用的本地服务器 COM 对象(系统插件可以调用 COM 方法)
另一种方法是让程序创建一个命名事件并等待它,卸载程序会向它发出信号,这将成为程序退出的线索。
作为最后的手段,您可以使用以下几个插件之一终止该进程:KillProcDLL,进程插件,KillProc 插件 和 NsProcess
另外, 锁定列表插件可能是更好的选择。
If your app has a window with a unique class name, you could just send it WM_CLOSE/WM_QUIT or whatever message you need.
Or your app could register a local server COM object the uninstaller could call (The system plugin can call COM methods)
Another way to do this is for the program to create a named event and wait on it, the uninstaller would signal it, this would be the clue for the program to quit.
As a last resort, you could kill the process with one of several plugins: KillProcDLL, Processes plug-in, KillProc plug-in and NsProcess
Also, the Locked List plugin might be a better alternative.