MFC的OnCreate/OnSize/OnInitDialog哪个先执行
1个回答
2016-09-28 · 知道合伙人软件行家
关注
展开全部
1、OnCreate/OnSize/OnInitDialog哪个先执行?
下面是从MSDN上选的:
OnCreate:The framework calls this member function when an application requests that the windows windows be created by calling the Create 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 the WM_INITDIALOG message. This message is sent to the dialog box during the Create, CreateIndirect, or DoModal calls, which occur immediately before the dialog box is displayed.
从MSDN的解释来看,OnCreate应该是在OnInitDialog之前被调用的。但是和OnSize的顺序还是看不太明显。于是……哈哈,我们有MessageBox
测试的结果是 OnCreate > OnSize > OnInitDialog
下面是从MSDN上选的:
OnCreate:The framework calls this member function when an application requests that the windows windows be created by calling the Create 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 the WM_INITDIALOG message. This message is sent to the dialog box during the Create, CreateIndirect, or DoModal calls, which occur immediately before the dialog box is displayed.
从MSDN的解释来看,OnCreate应该是在OnInitDialog之前被调用的。但是和OnSize的顺序还是看不太明显。于是……哈哈,我们有MessageBox
测试的结果是 OnCreate > OnSize > OnInitDialog
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询