"Ending program ... please wait" - what system message needs a response ?
-
I have a home-made app which performs fine, until the system is rebooted/restarted. Then I get the message "Ending program ... please wait", a timeout occurs, and then the app ends. As this is the only app which responds in this way, I assume that I have not coded the response to a system message which is causing the timeout. What system message is being sent and what response should be made to cause immediate termination ? Thanks in advance ! Doug
-
I have a home-made app which performs fine, until the system is rebooted/restarted. Then I get the message "Ending program ... please wait", a timeout occurs, and then the app ends. As this is the only app which responds in this way, I assume that I have not coded the response to a system message which is causing the timeout. What system message is being sent and what response should be made to cause immediate termination ? Thanks in advance ! Doug
Not completely sure but maybe what you need is WM_QUERYENDSESSION[^] or WM_ENDSESSION[^]? This[^] here might also be useful to read.
> The problem with computers is that they do what you tell them to do and not what you want them to do. < > //TODO: Implement signature here<
-
I have a home-made app which performs fine, until the system is rebooted/restarted. Then I get the message "Ending program ... please wait", a timeout occurs, and then the app ends. As this is the only app which responds in this way, I assume that I have not coded the response to a system message which is causing the timeout. What system message is being sent and what response should be made to cause immediate termination ? Thanks in advance ! Doug
AFAIK a Windows app will get terminated automatically if it is a WinForms app (hence a message pump is active) with proper event handling (always responsive, so no long-winding event handlers), AND no extra threads are running in the foreground. If you need background activity, I recommend you mark your threads background ones, so they don't prevent app shutdown. :)
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
-
AFAIK a Windows app will get terminated automatically if it is a WinForms app (hence a message pump is active) with proper event handling (always responsive, so no long-winding event handlers), AND no extra threads are running in the foreground. If you need background activity, I recommend you mark your threads background ones, so they don't prevent app shutdown. :)
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
Found the "problem" ! (Embarresing really !) I wrote this app a long time ago and used a dialog-based MFC app but prevented the dialog appearing so that it effectively ran in the background. The main "routine" was in InitDialog() and effectively prevented messages being handled by the "window". Now create a thread in InitDialog(), let it complete, and hide the window in another way. WM_QUERYENDSESSION is now handled, and all works fine ! Thanks for your thought-provoking comments !! :) Doug