ON_MESSAGE

ON_MESSAGE( message, memberFxn )

Parameters

message

The message ID.

memberFxn

The name of the message-handler function to which the message is mapped.

Remarks

Indicates which function will handle a user-defined message. User-defined messages are usually defined in the range WM_USER to 0x7FFF. User-defined messages are any messages that are not standard Windows WM_MESSAGE messages. There should be exactly one ON_MESSAGE macro statement in your message map for every user-defined message that must be mapped to a message-handler function.

For more information and examples, see Message Handling and Mapping Topics in Visual C++ Programmer’s Guide.

Example

// example for ON_MESSAGE
#define WM_MYMESSAGE (WM_USER + 1)
BEGIN_MESSAGE_MAP( CMyWnd, CMyParentWndClass )
    //{{AFX_MSG_MAP( CMyWnd
    ON_MESSAGE( WM_MYMESSAGE, OnMyMessage )
    // ... Possibly more entries to handle additional messages
    //}}AFX_MSG_MAP
END_MESSAGE_MAP( )

See Also   ON_UPDATE_COMMAND_UI, ON_CONTROL, ON_REGISTERED_MESSAGE, ON_COMMAND, User-Defined Handlers