Initial message transmission
1. afxwndproc ()
This function is used to receive messages, locate the cwnd object to which the message belongs, and call afxcallwndproc.
2. afxcallwndproc ()
This function is used to save a message (the content mainly contains the message identifier and message parameters) and then calls the windowproc () function.
3. windowproc ()
This function is used to send messages to the onwndmsg () function. if the message is not processed, the defwindowproc () function is called.
4. onwndmsg ()
The function first sorts messages by byte. For wm_command messages, the oncommand () Message response function is called, and the onnotify () Message response function is called for wm_notify messages. Any missed message is a window message. Onwndmsg () function searches for a message image to find a processing function that can process messages in any window. If the onwndmsg () function cannot find such a processing function, the message is returned to the windowproc () function, which sends the message to the defwindowproc () function.
5. oncommand ()
This function checks whether this is a control notification (the lparam parameter is not null. If the lparam parameter is null, the message is not a control notification). If it is oncommand () the function tries to map messages to the control that creates notifications. If it is not a control notification (or if the control rejects the mapped message) oncommand (), it calls the on1_msg () function.
6. on1_msg ()
Based on the class of receiving messages, the onreceivmsg () function potentially transmits command messages and control notifications in a process called command routing.
Sequence of Window Creation in MFC
1. precreatewindow () this function is an overload function. You can change the creation parameters in this overload function before the window is created.
2. presubclasswindow (), which is also an overload function that allows subclassification of a window.
3. ongetminmaxinfo () this function is a message response function that responds to wm_getminmaxinfo messages and allows you to set the maximum or minimum size of the window.
4. onnccreate () this function is also a message response function. It responds to the wm_nccreate message and sends a message to inform the customer zone of the window that will be created soon.
5. onnccalcsize () this function is also a message response function that responds to the wm_nccalcsize message. It allows you to change the size of the window client.
6. oncreate () this function is also a message response function. It responds to the wm_create message and sends a message to indicate that a window has been created.
7. onsize () this function is also a message response function that responds to the wm_size message and sends the message to indicate that the window size has changed.
8. The onmove () Message response function responds to the wm_move message. sending this message indicates that the window is moving
9. onchildnotify () this function is an overloaded function and is called as part of message ing, telling the parent window that a window has just been created
The order in which the MFC application closes the window (non-modal window)
1. onclose () Message response function. The wm_close message in the response window is sent when the close button is clicked.
2. ondestroy () Message response function, which refers to the wm_destroy message in the response window. When a window is destroyed, this message is sent.
3. onncdestroy () Message response function, which refers to the wm_ncdestroy message in the response window. This message is sent when a window is destroyed.
4. The postncdestroy () overload function is called by cwnd as the final action for processing the onncdestroy () function.
Sequence of opening the modal dialog box in MFC
1. domodal () is an overload function that reloads domodal () member functions.
2. presubclasswindow () is also an overload function that allows subclassification of a window.
3. oncreate () is a message response function that responds to the wm_create message and sends this message to indicate that a window has been created.
4. onsize () is also the message response function. It responds to the wm_size message and sends the message to notify the window size of the change.
5. onmove () is also a message response function. It responds to the wm_move message and sends this message to notify the window that it is moving.
6. onsetfont () is also a message response function. It responds to the wm_setfont message and sends this message to allow changing the font of the control in the dialog box.
7. oninitdialog () is also a message response function that responds to the wm_initdialog message and sends this message to allow the control in the initialization dialog box or create a new control.
8. onshowwindow () is also a message response function. It responds to the wm_showwindow message and is called by the showwindow () function.
9. onctlcolor () is also a message response function. In response to the wm_ctlcolor message, the color of the control in the changed dialog box or dialog box is sent by the parent window.
10. onchildnotify () is an overload function that is sent as the result of the wm_ctlcolor message.
Sequence of closing the modal dialog box in MFC
1. onclose () is a message response function that responds to the wm_close message. When the "close" button is clicked, this function is called.
2. onkillfocus () is also a message response function that responds to the wm_killfocus message. It is sent before a window is about to lose the keyboard input focus.
3. ondestroy () is also a message response function. It responds to the wm_destroy message and is sent when a window is about to be destroyed.
4. onncdestroy () is also a message response function. It responds to the wm_ncdestroy message and is sent when a window is destroyed.
5. postncdestroy () is also an overload function. It is called by cwnd as the final action for processing the onncdestroy () function.
Sequence of opening the non-modal dialog box in MFC
1. presubclasswindow () is an overload function that allows you to subclassify a window first.
2. oncreate () is a message response function that responds to the wm_create message and sends this message to indicate that a window has been created.
3. onsize () is also the message response function. It responds to the wm_size message and sends the message to tell the window size to change.
4. onmove () is also a message response function. It responds to the wm_move message and sends this message to notify the window that it is moving.
5. onsetfont () is also a message response function that responds to the wm_setfont message and sends this message to allow you to change the font of the control in the dialog box.
Sequence of closing the non-modal dialog box in MFC
1. onclose () is the message response function. The wm_close message in the response window is sent when the close button is clicked.
2. ondestroy () is also a message response function. The message wm_destroy in the response window is sent when a window is destroyed.
3. onncdestroy () is also a message response function. The wm_ncdestroy message in the response window is sent when a window is destroyed.
4. postncdestroy () is an overload function. It is called by cwnd as the final action for processing the onncdestroy () function.