class CMsgFrame : public CFrameWnd
{
private:
static const AFX_MSGMAP_ENTRY _messageEntries[];
protected:
static AFX_DATA const AFX_MSGMAP messageMap;
static const AFX_MSGMAP* PASCAL _GetBaseMessageMap();
virtual const AFX_MSGMAP* GetMessageMap() const;
}
const AFX_MSGMAP* PASCAL CMsgFrame::_GetBaseMessageMap()
{
return &CFrameWnd::messageMap;
}
const AFX_MSGMAP* CMsgFrame::GetMessageMap() const
{
return &CMsgFrame::messageMap;
}
AFX_COMDAT AFX_DATADEF const AFX_MSGMAP CMsgFrame::messageMap =
{
&CMsgFrame::_GetBaseMessageMap,
&CMsgFrame::_messageEntries[0]
};
AFX_COMDAT const AFX_MSGMAP_ENTRY CMsgFrame::_messageEntries[] =
{
{ WM_PAINT, 0, 0, 0, AfxSig_lwl,(AFX_PMSG)(AFX_PMSGW)(LRESULT (AFX_MSG_CALL CWnd::*)(WPARAM, LPARAM))&OnPaint },
{0, 0, 0, 0, AfxSig_end, (AFX_PMSG)0 }
};
用宏包裝了很多代碼,實現消息映射。具體可以看深入淺出mfc。上面將的很清楚