The order of processing messages in the MFC application
1.AFXWndProc () This function is responsible for receiving a message, find the CWND object belonging to the message, and then calls AFXCallWndProc
2.AfxCallWndProc () This function is responsible for saving messages (Saved content is mainly message identifier and message parameters) After use, then call WindowProc () functions
3.WindowProc () This function is responsible for sending a message to the OnWndMSG () function, if not processed, call the defWindowProc () function.
4. OnWndMSG () The function of this function first sorts the message by byte, call the oncommand () message response function for the WM_NOTIFY message for the WM_COMMAND message, call the onnotify () message response function. Any missing message will be a window message. OnWndMsg () function Search for message image to find a handler that can handle any window messages. If the onWndMsg () function cannot find such an processing function, return the message to the WindowProc () function, which is sent to the DEFWINDOWPROC () function.
5. OnCommand () This function View this is a control notification (LPARAM parameter is not null, if the LPARAM parameter is empty, the message is not a control notification), if it is, the oncommand () function will try to map messages to Manufacturing the control of the notification; if he is not a control notification (or if the control refuses to map) OnCMDMSG () function will call the onCMDMSG () function.
6.onCmdmsg () The oncmdmsg () function will notify the command message and control notification in a process called command delivery (Command Routing) based on the class. For example, if the class owns the window is a frame class, the command and notification message is also passed to the view and document class and find a message processing function for this class.
MFC application creates a window process
1.pRecreateWindow () This function is an overload function that changes the creation parameters in the overload function before the window is created (you can set the window style, etc.)
2.PResubClassWindow () This is also an overload function, allowing first to classify one window.
3.onGetMAXINFO () This function is a message response function, the response is the WM_GETMINMAXINFO message, allowing the maximum or minimum size of the window to set the window.
4. ANNCCREATE () This function is also a message response function, responding to the WM_NCCREATE message, sending a message to tell the window's client area is about to be created.
5.oncCalcSize () This function is also a message response function, responding to the WM_NCCALCSIZE message, the role is to allow changing the window customer area size
6. OnCreate () This function is also a message response function, responding to the WM_CREATE message, sending a message telling a window has been created.
7. On () This function is also a message response function, responding to the WM_SIZE message, sends the message to tell the window size has changed the 8.Onmove () message response function, responding to the WM_MOVE message, send this message description window in mobile
9. OnChildNotify () This function is an overload function, which is called as some message mapping, telling the parent window to be told that the window has just been created.
MFC application closes the order of the window (non-modular window)
1. OnClose () message response function, the response window's WM_CLOSE message, send this message when the button is turned off
2. Ondestroy () message response function, respond to the WM_DESTROY message of the window, send this message when a window will be destroyed
3.onncdestroy () message response function, responding to the WM_NCDESTROY message of the window, send this message when a window is destroyed
4.postncdestroy () overload function, as the final action of the handler of the onNCDestroy (), is called by CWND
Open Mode dialog in the MFC application
1.Domodal () overload function, overload Domodal () member functions
2.PResubClassWindow () overload function allows first to classify one window
3. Oncreate () message response function, respond to the WM_CREATE message, send this message to tell one window has been created
4. OnSIZE () message response function, respond to the WM_SIZE message, send this message to tell the window size change
5.onmove () message response function, respond to the WM_MOVE message, to send this message to tell the window being moving
6.onsetFont () message response function, respond to the WM_SETFONT message, send this message to allow the changing the font of the control in the dialog
7.ONITDIALOG () message response function, respond to the WM_INITDIALOG message, send this message to allow the control in the initialization dialog, or create a new control
8.onshowWindow () message response function, respond to the WM_SHOWINDOW message, the function is called by the showwindow () function
9.ONCTLCOLOR () message response function, respond to WM_CTLCOLOR messages, send the color of the changed dialog or dialog box or dialog on the control above the color
10. OnChildNotify () overload function, sent as a result of WM_CTLCOLOR messages
The order of the mode dialog box in the MFC application
1. OnClose () message response function, the function is called when the "Close" button is clicked.
2. ThenkillFocus () message response function, respond to the WM_KILLFOCUS message, when a window will lose the keyboard input focus before being sent
3. OnDestroy () message response function, respond to WM_DESTROY message, sent when a window is about to be destroyed
4.Ncdestroy () message response function, respond to the WM_NCDESTROY message, when a window is destroyed, the 5.postncdestroy () overload function is sent, as the last action of the handler of the oncdestroy () function is called by CWND
Open the order in which no mode dialog
1.preSUBCLASSWINDOW () overload function allows users to first classify one window
2. Oncreate () message response function, respond to the WM_CREATE message, send this message to tell a window has been created
3. OnSIZE () message response function, respond to the WM_SIZE message, send this message to tell the window size change
4. ANMOVE () message response function, respond to the WM_MOVE message, send this message to tell the window that is moving
5.ONSETFONT () message response function, respond to the WM_SETFONT message, send this message to allow the changing the font of the control in the dialog box
The above implementation is performed in a given order!
Only know what the application's execution order can you know when writing code, what should be performed, and where to do it! This is just a little less experience that I have summarized, I hope to help the beginners of MFC!