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