Message Maps, maps the user action in to the appropriate MFC class functions to handle it. The MFC Class which can handle message should be member of CCmdTarget, (i.e) it should be hierarchically derived from CCmdTarget.
The BEGIN_MESSAGE_MAP macro at the start of the message map specifies two class names as its arguments:
The first argument names the class to which the message map belongs. The second argument provides a connection with the immediate base class — CView here — so the framework can search its message map, too.
The message handlers provided in a base class are thus inherited by the derived class. This is very similar to normal virtual member functions without needing to make all handler member functions virtual which is an advantage since overhead of creating VTable is eliminated.
If no handler is found in any of the base-class message maps, default processing of the message is performed. If the message is a command, the framework routes it to the next command target. If it is a standard Windows message, the message is passed to the appropriate default window procedure.