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.mic开发者_如何学Pythonrosoft.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!
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?
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.
精彩评论