Since Windows is a message-oriented operating system, a large portion
of programming for the Windows environment involves message handling.
Each time an event such as a keystroke or mouse click occurs, a message
is sent to the application, which must then handle the event.
The Microsoft Foundation Class Library offers a programming model optimized for message-based programming. In this model, "message maps" are used to designate which functions will handle various messages for a particular class. Message maps contain one or more macros that specify which messages will be handled by which functions. For example, a message map containing an ON_COMMAND.
The Microsoft Foundation Class Library offers a programming model optimized for message-based programming. In this model, "message maps" are used to designate which functions will handle various messages for a particular class. Message maps contain one or more macros that specify which messages will be handled by which functions. For example, a message map containing an ON_COMMAND.
BEGIN_MESSAGE_MAP(CMyDoc, CDocument)
ON_COMMAND(ID_MYCMD, &CMyDoc::OnMyCommand)
END_MESSAGE_MAP().
The ON_COMMAND macro is used to handle command messages
generated by menus, buttons, and accelerator keys.
Source:MSDN
Source:MSDN