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

标签 windows windows-installer restartmanager windows-restart-manager

卸载我的应用程序时,如果它正在运行,它会尝试停止它:

enter image description here

遗憾的是,自动关闭并没有真正起作用,并且显示此错误:

enter image description here

我的应用程序消失了,窗口、托盘栏图标都消失了。但我仍然可以在进程列表中看到它们。

我猜测 Windows 向应用程序发送了一个信号以正常退出,并且 UI 也这样做了,但有一些延迟线程阻止进程终止。

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

一旦我知道这一点,我想在调试我的应用程序时模拟它,看看发生了什么。这是一个合理的计划吗?

最佳答案

自 Windows Vista 起,Windows Installer 将利用 Restart Manager识别、关闭和重新启动应用程序。 Microsoft 关于 Using Restart Manager 的文档,特别是Using Restart Manager with a Primary Installer应该是实现测试工具的坚实起点。您的应用程序和服务应遵循 Guidelines for Applications and Services .

Guidelines for Applications讨论重启管理器发送到您的应用程序的消息; services通过服务控制管理器重新启动。理论上,您可以在该级别模拟重新启动管理器,但我怀疑您最好通过调用真实的东西来为您提供更好的服务,注册精心选择的 resources 列表。如果可能的话,只针对您的应用程序。

关于windows - Windows Installer 如何在卸载过程中关闭应用程序?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50274420/

相关文章:

properties - 如何在 WiX 中使用 SourceDir MSI 属性?

Windows:Boost 和 CMake

windows - 在 Docker for Windows 中运行正常的 Win32 应用程序

windows - 在 Windows 上执行互斥安装?

visual-studio - 弄清楚 Visual Studio 使用的 Windows SDK

windows - 生成的 Windows 应用商店应用程序包名称看起来很奇怪

c++ - 当检查是eof时,使用getline读取文本文件会导致无限循环

msdn - Windows 重启管理器的 RmGetList 返回 ERROR_ACCESS_DENIED,为什么?

wcf - RestartManager 导致辅助角色重新启动