MFC message handling procedures order

Author:Anonymous    Updated:2008-3-20 23:11:35
MFC applications in the order of processing information

1.AfxWndProc () function responsible for receiving the information, find information on their CWnd object, and then call AfxCallWndProc

2.AfxCallWndProc () function is responsible for the preservation of information (the content is mainly preservation news and information identifier parameters) supply procedures used after use, and then call WindowProc () function

3.WindowProc () function responsible for sending the message to OnWndMsg () function, if not dealt with, then call DefWindowProc () function

4.OnWndMsg () function of the functional by the first byte sort of news, WM_COMMAND information, call OnCommand () function response information, call WM_NOTIFY news OnNotify () source response function. Any omission will be a source of information window. OnWndMsg () function of the news image search to find a window to deal with any of the information processing function. If OnWndMsg () function can not find the address of the function, put the news back to WindowProc () function, it would send the message to the DefWindowProc () function

5.OnCommand () function Show this notice is not a control (lParam parameter to NULL if lParam parameter is empty, then the news is not that controls notice), if it is, OnCommand () function will attempt to news Mapping to manufacturing controls notice if he is not a control notice (or if the controls refused mapping information) OnCommand () will call OnCmdMsg () function

6.OnCmdMsg () According to receive news category, OnCmdMsg () function will be known as a transfer order (Command Routing) potential in the process of the transfer order and control information notice. For example: If the owner of the window is a framework category, orders and alerts have been sent to view and document type, and to find such a message processing function

 

MFC create windows application process

1.PreCreateWindow () function is an override function, the window was created before the override function can be changed to create parameters (you can set the window style, etc.)

2.PreSubclassWindow () function This is a heavy load, allowing a window for the first subcategories

3.OnGetMinMaxInfo () function for news of the response function, the response is WM_GETMINMAXINFO information, allow you to set up the largest or smallest window size

4.OnNcCreate () function is a source of the response function, response WM_NCCREATE information, send information to tell the customer window was about to create district

5.OnNcCalcSize () function is also news of the response function, response WM_NCCALCSIZE news, the role is to allow customers to change the size window

6.OnCreate () function is a source of the response function, response WM_CREATE information, send information to tell a window has been created

7.OnSize () function is a source of the response function, response WM_SIZE information, send the information to tell the window size has changed

8.OnMove () source response function, response WM_MOVE news, sending this message that window in the mobile

9.OnChildNotify () function to override the function, as part of information mapping is called, the father told the window was about to inform a window just been created

 

MFC application window closed in the order (non-modal window)

1.OnClose () source response function, response window WM_CLOSE news by clicking the Close button when the time sending this message

2.OnDestroy () source response function, response window WM_DESTROY news when a window will be destroyed, sending this message

3.OnNcDestroy () source response function, response window WM_NCDESTROY news when a window is destroyed after sending this message

4.PostNcDestroy () Heavy function as processing OnNcDestroy () function of the final action was called CWnd


MFC application model in the open dialog function call sequence

1.DoModal () function override, override DoModal () member function

2.PreSubclassWindow () function override, allowing a window for the first subcategories

3.OnCreate () source response function, response WM_CREATE news, sending this message to tell a window has been created

4.OnSize () source response function, response WM_SIZE news, sending this message to tell the window size changes

5.OnMove () source response function, response WM_MOVE news, sending this message to tell the moving window

6.OnSetFont () source response function, response WM_SETFONT news, sending this message to allow change the font dialog box controls

7.OnInitDialog () source response function, response WM_INITDIALOG news, sending this message to allow initialization controls in the dialog box, or create new controls

8.OnShowWindow () source response function, response WM_SHOWWINDOW news, the function was ShowWindow () function call

9.OnCtlColor () source response function, response WM_CTLCOLOR information has been sent by the Father window or dialog box to change the color of the above controls

10. OnChildNotify () override function, as the result of information sent WM_CTLCOLOR

 

MFC-down mode applications in the order of the dialog box

1.OnClose () source response function, response WM_CLOSE news, when "off" button is the click when the function was called

2.OnKillFocus () source response function, response WM_KILLFOCUS news, a window will be lost when the keyboard input focus before being sent

3.OnDestroy () source response function, response WM_DESTROY news when a window about to be destroyed, he was sent

4.OnNcDestroy () source response function, response WM_NCDESTROY news when a window was destroyed after being sent

5.PostNcDestroy () Heavy function as processing OnNcDestroy () function of the final action was called CWnd


Open dialog with the order model

1.PreSubclassWindow () override function, which allows users a window for the first subcategories

2.OnCreate () source response function, response WM_CREATE news, sending this message to tell a window has been created

3.OnSize () source response function, response WM_SIZE news, sending this message to tell the window size changes

4.OnMove () source response function, response WM_MOVE news, sending this message to tell the moving window

5.OnSetFont () source response function, response WM_SETFONT news Send this information to permit any change in the font dialog box controls


These are the implementation of the order given by the Executive!

Only a clear understanding of the application's implementation of the order, in the preparation of the code can know when, in what should be and what time, in any place, as well as what the handle!
This is only a small point, I sum up experience, the MFC hopes to help beginners
Previous:MFC image with the news of dynamic menu
Next:Windows of multithreaded programming preliminary
User Reviews
Related Articles
Recommended article
AD