[msw 2.8.7] Problem saving application settings when system is shut down

Eric Jensen ml at j-dev.de
Fri Apr 11 09:06:50 PDT 2008


VZ> On Tue, 8 Apr 2008 19:23:29 +0200 Eric Jensen <ml at j-dev.de> wrote:

EJ>> However, when the system is shut down, i get this:
EJ>> 
EJ>> 04/08/08 17:34:45: MyApp::OnAppQueryEndSession
EJ>> 04/08/08 17:34:45: MyFrame::OnClose
EJ>> 04/08/08 17:34:45: MyApp::OnAppEndSession
EJ>> 04/08/08 17:34:45: MyFrame::OnClose
EJ>> 
EJ>> I receive the EVT_END_SESSION events and the OnClose handler gets
EJ>> called, but neither the frame dtor nor wxApp::Exit().
EJ>> 
EJ>> Event if i explicitly call frame->Destroy() or wxApp()::ExitMainLoop()
EJ>> in the EVT_END_SESSION event handler this does not change.
EJ>> 
EJ>> Is this the "normal" expected behavior?

i did some more research on this topic, putting debug output into a
file at many places in the wx eventloop and message handlers.

Although i can't provide a definite proof, i think the behavior i
described is indeed "normal":
After responding to the WM_ENDSESSION handler, Windows immediately
kills the process without any chance to do any more work.

Various posts regarding this topic i found in Google seem to support
that theory, although none of them explicitly states it.

MSDN says:
"Once an application responds to WM_ENDSESSION, Windows closes it."
Source:
http://msdn2.microsoft.com/en-us/library/ms700677.aspx

Unfortunately this is not very clear, but "might" mean what i
observed.

Regards, Eric




More information about the wx-users mailing list