mfc中消息映射机制分析(编辑修改稿)内容摘要:

怪符号 //}}和 //{{,是 ClassWizard产生的,对程序无 影响。 观察 DECLARE_MESSAGE_MAP 的定义: define DECLARE_MESSAGE_MAP () private: static const AFX_MESSAGE_ENTRY _messageEntries[]。 protected: static AFX_DATA const AFX_MSGMAP messageMap。 virtual const AFX_MSGMAP* GetMessageMap() const。 里面又包含了 MFC 新定义的两个数据结构,如下: AFX_MSGMAP_ENTRY struct AFX_MSGMAP_ENTRY { UINT nMessage。 // windows message UINT nCode。 // control code or WM_NOTIFY code UINT nID。 // control ID (or 0 for windows messages) UINT nLastID。 // used for entries specifying a range of control id39。 s UINT nSig。 // signature type (action) or pointer to message AFX_PMSG pfn。 // routine to call (or special value) }。 和 AFX_MSGMAP struct AFX_MSGMAP { const AFX_MSGMAP* pBaseMap。 const AFX_MSGMAP_ENTRY* lpEntries。 }。 其中 AFX_MSGMAP_ENTRY 结构包含了一个消息的所有相关信息 ,而 AFX_MSGMAP 主要作用有两个,一是用来得到基类的消息映射入口地址。 二是得到本身的消息映射入口地址。 实际上, MF。
阅读剩余 0%
本站所有文章资讯、展示的图片素材等内容均为注册用户上传(部分报媒/平媒内容转载自网络合作媒体),仅供学习参考。 用户通过本站上传、发布的任何内容的知识产权归属用户或原始著作权人所有。如有侵犯您的版权,请联系我们反馈本站将在三个工作日内改正。