다음을 통해 공유


Message Map Macros (MFC)

To support message maps, MFC supplies the following macros:

Message-Map Declaration and Demarcation Macros

DECLARE_MESSAGE_MAP

Declares that a message map will be used in a class to map messages to functions (must be used in the class declaration).

BEGIN_MESSAGE_MAP

Begins the definition of a message map (must be used in the class implementation).

END_MESSAGE_MAP

Ends the definition of a message map (must be used in the class implementation).

Message-Mapping Macros

ON_COMMAND

Indicates which function will handle a specified command message.

ON_CONTROL

Indicates which function will handle a specified control-notification message.

ON_MESSAGE

Indicates which function will handle a user-defined message.

ON_OLECMD

Indicates which function will handle a menu command from a DocObject or its container.

ON_REGISTERED_MESSAGE

Indicates which function will handle a registered user-defined message.

ON_REGISTERED_THREAD_MESSAGE

Indicates which function will handle a registered user-defined message when you have a CWinThread class.

ON_THREAD_MESSAGE

Indicates which function will handle a user-defined message when you have a CWinThread class.

ON_UPDATE_COMMAND_UI

Indicates which function will handle a specified user-interface update command message.

Message-Map Range Macros

ON_COMMAND_RANGE

Indicates which function will handle the range of command IDs specified in the first two parameters to the macro.

ON_UPDATE_COMMAND_UI_RANGE

Indicates which update handler will handle the range of command IDs specified in the first two parameters to the macro.

ON_CONTROL_RANGE

Indicates which function will handle notifications from the range of control IDs specified in the second and third parameters to the macro. The first parameter is a control-notification message, such as BN_CLICKED.

For more information on message maps, the message-map declaration and demarcation macros, and the message-mapping macros, see Message Maps and Message Handling and Mapping Topics. For more information about message-map ranges, see Handlers for Message-Map Ranges.

See Also

Reference

Message Maps (MFC)