Windows 关闭取消 - 重新启动已关闭的应用程序

发布于 2024-10-29 09:11:06 字数 348 浏览 2 评论 0原文

我有一个应用程序在收到关闭事件时停止,但该应用程序需要在用户会话中持续运行。如果有程序阻止关机,然后用户“取消”关机,则应用程序将不再运行。

有没有办法让Windows重新启动应用程序或让应用程序成为最后一个关闭的应用程序?

我已阅读: http://msdn.microsoft.com /en-us/library/ms686227%28VS.85%29.aspx 但这只会更改通知的顺序,并且在阻止关闭的应用程序终止后不会收到通知。

谢谢!

I have an application that stops when the shutdown event is received but this application needs to be continuously running in the user session. If there are programs preventing shutdown and then the user 'cancels' the shutdown the application is no longer running.

Is there a way to have windows restart the application or have the application be the very last application to shut down?

I have read: http://msdn.microsoft.com/en-us/library/ms686227%28VS.85%29.aspx but this only changes the order of the notification, and is not received after the applications preventing a shutdown are terminated.

thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

慈悲佛祖 2024-11-05 09:11:06

有没有办法让Windows重新启动
申请或拥有
申请是最后的
应用程序要关闭吗?

这将违反“如果两个程序执行此操作会怎样?< /a>”校长。

您是否使用过 SetProcessShutdownParameters() 来延迟应用程序关闭?这还不够吗?

Is there a way to have windows restart
the application or have the
application be the very last
application to shut down?

This would violate the "What if two programs did this?" principal.

Have you used SetProcessShutdownParameters() to delay your apps shut down? Is that not enough?

§对你不离不弃 2024-11-05 09:11:06

WM_ENDSESSION 添加到您的 Windows 消息处理中环形;仅当 Windows 实际上关闭时才会发送此消息。如果由于某种原因您的应用程序需要干预关闭过程,您还可以响应 WM_QUERYENDSESSION 消息。

Add WM_ENDSESSION to your Windows message handling loop; this is only sent when Windows is in fact shutting down. If for some reason your app needs to intervene in the shutting down process, you can also respond to the WM_QUERYENDSESSION message.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文