MFC的消息映射机制实际是由一个类自定义的函数列表来完成,中间有些小技巧需要注意 OwnMessageMapDef.h #ifndef _OWN_MESSAGE_MAP_DEF_H #define _OWN_MESSAGE_MAP_DEF_H //######################################################################## // Own message map define // Created by Lifei // enum OwnSig { OwnSig_end = 0, OwnSig_v_v = 1, OwnSig_v_i = 2, OwnSig_v_pc_i = 3, OwnSig_i_pc_i = 4, }; // class COwnMessageMap; typedef void (COwnMessageMap::*OWN_PMSG)(void); typedef void (COwnMessageMap::*OWN_PMSG_V_I)(int); typedef void (COwnMessageMap::*OWN_PMSG_V_PCHAR_I)(char*, int); typedef int (COwnMessageMap::*OWN_PMSG_I_PCHAR_I)(char*, int); union MessageMapFunctions { OWN_PMSG pfn; OWN_PMSG_V_I pfn_v_i; OWN_PMSG_V_PCHAR_I pfn_v_pc_i; OWN_PMSG_I_PCHAR_I pfn_i_pc_i; }; // struct OWN_MSGMAP_ENTRY { unsigned int nMessage; OwnSig ownSig; OWN_PMSG pfn; }; struct OWN_MSGMAP { const OWN_MSGMAP* (__st