int CServerApp::ExitInstance() 
{
// TODO: Add your specialized code here and/or call the base class
MessageBox(NULL, "UnInit", "Message", MB_OK);
CServerDlg SerDlg;
SerDlg.m_NetSvr.UnInit();
CoUninitialize();

return CWinApp::ExitInstance();
}为什么关闭程序前没有出来信息框?

解决方案 »

  1.   

    可能的原因,是因为线程把User32.dll卸载了~
      

  2.   

    你的应用程序是基于对话框的吧?
    看了这篇文章,你就知道原因了。http://support.microsoft.com/kb/253130/en-us解决方案就是在Initinstance中将 m_pMainWnd = &dlg;这句注释掉。
      

  3.   

    CServerApp不是从cwn类继承的。因此不能用messagebox.他是cwn类的成员函数.你可以用AfxMessageBox("222");在你关闭的时候可以出来的!!!int CMy255555App::ExitInstance() 
    {
    // TODO: Add your specialized code here and/or call the base class    AfxMessageBox("222");

    return CWinApp::ExitInstance();
    }
      

  4.   

    在 ExitInstance()  前 主窗口已经销毁了
      

  5.   

    问题出在MessageBox。
    支持4楼哥们的说法
      

  6.   


    解决方案就是在Initinstance中将 m_pMainWnd = &dlg;这句注释掉。这种方法我的程序运行时崩溃AfxMessageBox("222"); 这种方法也没反应谢谢大家的回复虽然没解决,但也学到点,现给分了
      

  7.   

    那你知道为什么AfxMessageBox没有反应吗?
    因为AfxMessageBox和你的MessageBox调用原理是一样的。
    4楼和6楼说MessageBox不能被调用,可能是他们没注意到你的程序调用的不是CWnd类的内置MessageBox函数,而是sdk中MessageBox函数。
    至于为什么会崩溃,microsoft网站上并没有说,不过问题应该不难解决,你可以帖出程序崩溃在何处,我可以帮你解决。