MFC的OnCreate/OnSize/OnInitDialog哪个先执行?

来源:互联网 发布:windows平板在哪装软件 编辑:程序博客网 时间:2024/04/29 02:18
 
1、OnCreate/OnSize/OnInitDialog哪个先执行?
    下面是从MSDN上选的:
    OnCreate:The framework calls this member function when an application requests that the windows windows be created by calling theCreate or CreateEx member function. The CWnd object receives this member function to perform any needed initialization before it becomes visible.
    OnSize: The framework calls this member function after the window's size has changed.
    OnInitDialog:This member function is called in response to theWM_INITDIALOG message. This message is sent to the dialog box during theCreate, CreateIndirect, or DoModal calls, which occur immediately before the dialog box is displayed.
     从MSDN的解释来看,OnCreate应该是在OnInitDialog之前被调用的。但是和OnSize的顺序还是看不太明显。于是……哈哈,我们有MessageBox
     测试的结果是 OnCreate > OnSize > OnInitDialog