1. the toolbar and menu bar button messages are the so-called command messages. The message transmission method is to turn back (according to instructor Hou Junjie), and the message will first go to view, here, the view is the activity view of MFC, Which is set with setactiveview.
2. The mouse and keyboard messages are common Windows messages, which are delivered in a straight line. The scroll wheel and keyboard messages are sent to the view with the focus and set with setfocus. If the focus is not set, messages are sent to the activeview; A message such as clicking, double-clicking, and right-clicking will be sent to the attempt with capture and set with setcapture. If no setting is set, it will go to windowfrompoint (to obtain the handle of the window containing the specified vertex.
The following is the definition of msdn:
In fact, you can see the definition of msdn.
They all have differences.
Setcapture
This function sets the mouse or style capture to a specified window that belongs to the current thread. after you call this function for a window, the window captures mouse input that occurs while the mouse cursor remains within the window. the window also captures mouse input that occurs when the user presses a mouse button while the mouse cursor is located within the window and continues to hold the mouse button down while moving the mouse. only one window at a time can capture the mouse or stylus.
setfocus function
the setfocus function sets the keyboard focus to the specified window. The window must be attached to the calling thread's message queue.