Home > DeveloperSection > Interviews > Which are the various message map macros ?

Posted on    March-28-2011 8:58 AM

 Visual C++ Visual C++ 
 1 Answer(s)
  1431  View(s)
Rate this:

Amit Singh

Total Post:565

Posted on    March-28-2011 12:00 AM

Message maps are an MFC approach to windows programming. Instead of writing a WinMain () function that sends messages to your WindProc and then writing a WindProc that checks which kind of message this is and then calls another of your functions, you just write the function that will handle the message, and you add a message map to your class that says, in effect, "I will handle this sort of message." The framework handles whatever routing is required to send that message to you.
A number of macros are used in message maps:- DECLARE_MESSAGE_MAP: used in the include file to declare that there will be a message map in the source file.- BEGIN MESSAGE MAP: marks the beginning of the message map in the source file.- END MESSAGE MAP: marks the end of the message map- ON_COMMAND: used to delegate the handling of a command to a function of a class.- ON_COMMAD_RANGS: used to handle a group of commands- ON_MESSAGE: used to delegate the handling of a user defined message to a function- ON_NOTIFY: used to handle the control notification message with some extra information and calls a member function of a class.

Don't want to miss updates? Please click the below button!

Follow MindStick