MFC应用程序如何终止自身?

Mik*_*ike 10 c++ mfc visual-c++

MFC应用程序干净利落的正确方法是什么?

Mik*_*ike 14

AfxGetMainWnd()->PostMessage(WM_CLOSE);
Run Code Online (Sandbox Code Playgroud)


小智 10

以编程方式终止MFC应用程序

 void ExitMFCApp()
   {
        // same as double-clicking on main window close box
        ASSERT(AfxGetMainWnd() != NULL);
        AfxGetMainWnd()->SendMessage(WM_CLOSE);
   }
Run Code Online (Sandbox Code Playgroud)

http://support.microsoft.com/kb/117320