对于这个问题关键是它们针对的对象不同:
构造函数主要针对的是C++的类对象的成员变量的初始化,是内在的,而OnInitDialog()主要针对的是与类对象相关联的windows窗体上控件的初始化问题,是外在的。
在MSDN中微软是这样说的:
Commonly Overridden Member Functions of Class CDialog
Member function Message it responds to Purpose of the override
OnInitDialog WM_INITDIALOG Initialize the dialog box's controls.
OnOK BN_CLICKED for button IDOK Respond when the user clicks the OK button.
OnCancel BN_CLICKED for button IDCANCEL Respond when the user clicks the Cancel bu
OnCancel BN_CLICKED for button IDCANCEL Respond when the user clicks the Cancel bu