不好意思,麻烦了大家,问题我已解决。主要原因是我没仔细看msdn上的东东。实际上用m_pMainWnd的DestroyWindow();完全可行。当然标准的调用是:OnClose ();呵呵,msdn上的原话如下:
Destroying Frame WindowsSee Also
Using Frame Windows
The MFC framework manages window destruction as well as creation for those windows associated with framework documents and views. If you create additional windows, you are responsible for destroying them.
In the framework, when the user closes the frame window, the window's default OnClose handler calls DestroyWindow. The last member function called when the Windows window is destroyed is OnNcDestroy, which does some cleanup, calls the Default member function to perform Windows cleanup, and lastly calls the virtual member function PostNcDestroy. The CFrameWnd implementation of PostNcDestroy deletes the C++ window object. You should never use the C++ delete operator on a frame window. Use DestroyWindow instead.
When the main window closes, the application closes. If there are modified unsaved documents, the framework displays a message box to ask if the documents should be saved and ensures that the appropriate documents are saved if necessary.
我多希望自己能给自己加分。呵呵。结铁吧