简体   繁体   English

Windows Installer如何在卸载过程中关闭应用程序?

[英]How does Windows Installer close an application during uninstall?

When uninstalling my application, it attempts to stop it if it's running: 卸载我的应用程序时,如果正在运行,它将尝试将其停止:

在此处输入图片说明

Sadly, the automatically closing doesn't really work and it displays this error: 可悲的是,自动关闭并没有真正起作用,它显示以下错误:

在此处输入图片说明

My applications disappear, the windows, the tray bar icon, they are all gone. 我的应用程序消失了,窗户,托盘栏图标都消失了。 But I can still see them in the process list. 但是我仍然可以在进程列表中看到它们。

I'm guessing Windows sends a signal to the applications to exit gracefully and the UI does so, but there's some lingering thread preventing the processes from terminating. 我猜想Windows会向应用程序发送信号以正常退出,而UI会这样做,但是有一些缠绵的线程阻止进程终止。

How does Windows Installer close an application during uninstall? Windows Installer如何在卸载过程中关闭应用程序?

Once I know this I want to simulate it while debugging my app to see what's going on. 知道这一点后,我想在调试我的应用程序时对其进行仿真,以了解发生了什么情况。 Is this a sound plan? 这是合理的计划吗?

Since Windows Vista, Windows Installer will leverage the Restart Manager to identify, close, and restart applications. 从Windows Vista开始,Windows Installer将利用重新启动管理器来识别,关闭和重新启动应用程序。 Microsoft's documentation on Using Restart Manager , and in particular Using Restart Manager with a Primary Installer should be a solid starting point for implementing a test harness. Microsoft的有关使用Restart Manager的文档,特别是有关将Restart Manager与主安装程序一起 使用的文档,应该是实施测试工具的坚实起点。 Your applications and services should instead follow the Guidelines for Applications and Services . 您的应用程序和服务应改为遵循“应用程序和服务准则”

The Guidelines for Applications discuss the messages sent to your application by the restart manager; 应用程序准则讨论了重启管理器发送到您的应用程序的消息; services are restarted through the service control manager. 服务通过服务控制管理器重新启动。 In theory you could simulate the restart manager at that level, but I suspect you'd be better served by invoking the real thing, registering a carefully chosen list of resources to target just your application, if possible. 从理论上讲,您可以在该级别上模拟重启管理器,但是我怀疑最好通过调用真实对象,如果可能的话,注册一个精心选择的资源列表以仅针对您的应用程序,从而为您提供更好的服务。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM