Figure 1   Expanded Macros

 // The code below shows how the preprocessor expands the following lines.
 //
 //    IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd)
 //    BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
 //       ON_WM_CREATE()
 //    END_MESSAGE_MAP()
 //
 // Comments added by me
 
 // creation function (the CREATE in DYNCREATE)
 CObject* __stdcall CMainFrame::CreateObject() 
 { 
    return new CMainFrame; 
 } 
 
 ////////////////////////////////////////////////////////////////
 // The following stuff is all from IMPLEMENT_DYNCREATE
 
 // CMainFrame runtime class object
 const CRuntimeClass CMainFrame::classCMainFrame = 
    { "CMainFrame", sizeof(class CMainFrame), 
       0xFFFF, CMainFrame::CreateObject,
       ((CRuntimeClass*)(&CFrameWnd::classCFrameWnd)),
       0
    };
 
 // function to get the runtime class object returns above
 CRuntimeClass* CMainFrame::GetRuntimeClass() const
    { return ((CRuntimeClass*)(&CMainFrame::classCMainFrame)); }
 
 // function to get the message map
 const AFX_MSGMAP* CMainFrame::GetMessageMap() const
    { return &CMainFrame::messageMap; }
 
 // the message map
 const AFX_MSGMAP CMainFrame::messageMap = { 
    &CFrameWnd::messageMap, &CMainFrame::_messageEntries[0]
 };
 
 ////////////////////////////////////////////////////////////////
 // The following is message map stuff
 
 // BEGIN_MESSAGE_MAP
 const AFX_MSGMAP_ENTRY CMainFrame::_messageEntries[] = {
 
 // ON_WM_CREATE
    { 0x0001, 0, 0, 0, AfxSig_is,
       (AFX_PMSG)(AFX_PMSGW)(int ( CWnd::*)(LPCREATESTRUCT))&OnCreate },
 
 // END_MESSAGE_MAP
    {0, 0, 0, 0, AfxSig_end, (AFX_PMSG)0 }  // zero-terminator entry
 };