|
From: Vadim Zeitlin on 17 Apr 2008 20:23 On Thu, 17 Apr 2008 22:19:27 +0200 Eric Jensen <ml(a)j-dev.de> wrote: EJ> just creating a dummy window did not work. Even creating a dummy EJ> wxFrame in wxApp::OnEndSession() did not change the behavior. Which EJ> confused me a bit, cause i'm still not 100% sure what actually EJ> triggers killing the process. My hypothesis is that the destruction of the last window belonging to it does. EJ> Your second idea worked though. Here is what we have now: EJ> EJ> void wxApp::OnEndSession(wxCloseEvent& WXUNUSED(event)) EJ> { EJ> //if(GetTopWindow()) GetTopWindow()->Close(true); EJ> // Windows will terminate the process soon after we EJ> // return from WM_ENDSESSION handler anyhow, so make EJ> // sure we at least execute our cleanup code before EJ> EJ> if(wxTopLevelWindows.GetCount()>0) { EJ> wxTopLevelWindows[0]->SetHWND(NULL); EJ> } EJ> EJ> const int rc = OnExit(); EJ> wxEntryCleanup(); EJ> EJ> // calling exit() instead of ExitProcess() or not doing EJ> // anything at all and being killed by Windows has the EJ> // advantage of executing the dtors of global objects EJ> exit(rc); EJ> } EJ> EJ> Saving the old HWND and calling ::DestroyWindow() on it later does not EJ> work (leads to a crash). EJ> EJ> I'll do some more testing tomorrow. Please let me know if you discover any problems with this or whether I should go ahead and apply it. Thanks, VZ -- TT-Solutions: wxWidgets consultancy and technical support http://www.tt-solutions.com/
|
Pages: 1 Prev: Getting items on wxWidgets home page Next: wxWindow without application class |