Message mapping mechanism

zhaozj2021-02-08  250

Message mapping mechanism

Any class that requires a message map, must join Declare_MESSAGE_MAP () in its definition.

Macro DECLARE_MESSAGE_MAP () is defined as follows: #ifdef _AFXDLL # define DECLARE_MESSAGE_MAP () / private: / static const AFX_MSGMAP_ENTRY _messageEntries []; / // login using private array _messageEntries AFX_MSGMAP_ENTRY called logon message protected: / static AFX_DATA const AFX_MSGMAP messageMap; / // points to an array of messages to log message map static const AFX_MSGMAP * PASCAL _GetBaseMessageMap (); / // returns the message map of the address virtual const AFX_MSGMAP * GetMessageMap () const; / # else # define DECLARE_MESSAGE_MAP () / private: / static const AFX_MSGMAP_ENTRY _messageEntries []; / protected: / static AFX_DATA const AFX_MSGMAP messageMap; / virtual const AFX_MSGMAP * GetMessageMap () const; / # endifAFX_MSGMAP_ENTRY defined as follows: struct AFX_MSGMAP_ENTRY {UINT nMessage; // windows messageUINT nCode; // control code or WM_NOTIFY codeUINT nID; // control ID (or 0 for windows messages) UINT nLastID; // used for entries specifying a range of control id'sUINT nSig; // signature type (action) or pointer to message #AFX_PMSG pfn; // Routine to call (or special value)}; AFX_MSGMAP is defined as follows: // is a dynamic chain table, each node contains a pointer to the next node and points to AFX_MSGMAP_ENTR Y's pointer struct AFX_MSGMAP {#ifdef _afxdllconst AFX_MSGMAP * () (); # elseconst AFX_MSGMap * PBaseMap; #ENDIFCONST AFX_MSGMAP_ENTRY * LpenTries;};

转载请注明原文地址:https://www.9cbs.com/read-2516.html

New Post(0)