Chapter 5: The Document/View Architecture Visual C++ and MFC Fundamentals
RUNTIME_CLASS(CExerciseDoc),
RUNTIME_CLASS(CMainFrame),
RUNTIME_CLASS(CExerciseView));
AddDocTemplate(pDocTemplate);CCommandLineInfo cmdInfo;// Dispatch commands specified on the command line
if (!ProcessShellCommand(cmdInfo))
return FALSE;// The one and only window has been initialized, so show and update it.
m_pMainWnd->ShowWindow(SW_SHOW);
m_pMainWnd->UpdateWindow();return TRUE;
}// -- Frame Map -- //
IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd)
BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
ON_WM_CREATE()
END_MESSAGE_MAP()// -- Document Map -- //
IMPLEMENT_DYNCREATE(CExerciseDoc, CDocument)
BEGIN_MESSAGE_MAP(CExerciseDoc, CDocument)END_MESSAGE_MAP()// -- View Map --
IMPLEMENT_DYNCREATE(CExerciseView, CEditView)
BEGIN_MESSAGE_MAP(CExerciseView, CEditView)END_MESSAGE_MAP()int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
// Call the base class to create the window
if( CFrameWnd::OnCreate(lpCreateStruct) == 0)
return 0;return -1;
}CExerciseApp theApp;- Test the application