|
-
March 29th, 1999, 10:46 AM
#1
OnAppExit()
What is the default action for the Application exit? I tried creating a message map for OnAppExit to perform some checking and cleanup. Everything worked except the applicaiton did not exit. So, I added exit(0) to the end of the function. In debug mode, everything works fine but in release mode I get an exception and the program crashes. I disabled the function and message map and the program exists without any problem in release or debug. What should I call to terminate the application when overriding the AppExit()?
Thanks,
Steve
-
March 29th, 1999, 10:58 AM
#2
Re: OnAppExit()
The CWinApp default handler does:
void CWinApp::OnAppExit()
{
// same as double-clicking on main window close box
ASSERT(m_pMainWnd != NULL);
m_pMainWnd->SendMessage(WM_CLOSE);
}
Explicitly calling this from your overridden handler should work fine, although I might like to suggest that you do your stuff in an override of CWinApp::ExitInstance() or the even the destructor of your Application object.
-
March 29th, 1999, 11:02 AM
#3
Re: OnAppExit()
Are you calling the base class implementation at the end of your override?
void MyApp::OnAppExit()
{
// do cleanup
...
CWinApp::OnAppExit(); // call base class implementation
}
Dave
-
March 29th, 1999, 07:47 PM
#4
Re: OnAppExit()
Do NOT use exit(0) from a Windows application
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|