共用方式為


DECLARE_MESSAGE_MAP

Declares that the class defines a message map. Each CCmdTarget-derived class in your program must provide a message map to handle messages.

DECLARE_MESSAGE_MAP( )

Remarks

Use the DECLARE_MESSAGE_MAP macro at the end of your class declaration. Then, in the .cpp file that defines the member functions for the class, use the BEGIN_MESSAGE_MAP macro, macro entries for each of your message-handler functions, and the END_MESSAGE_MAP macro.

注意

If you declare any member after DECLARE_MESSAGE_MAP, you must specify a new access type (public, private, or protected) for them.

For more information on message maps and the DECLARE_MESSAGE_MAP macro, see Message Handling and Mapping Topics.

Example

class CMainFrame : public CMDIFrameWnd
{
   DECLARE_MESSAGE_MAP()

   // Remainder of class declaration omitted.

Requirements

Header: afxwin.h

See Also

Concepts

MFC Macros and Globals

BEGIN_MESSAGE_MAP

END_MESSAGE_MAP