Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All


Initializes the MFC dialog box by creating and hosting a Windows Forms user control on it.

virtual BOOL OnInitDialog();

A boolean value that specifies whether the application has set the input focus to one of the controls in the dialog box. If OnInitDialog returns nonzero, Windows sets the input focus to the first control in the dialog box. This method can return 0 only if the application has explicitly set the input focus to one of the controls in the dialog box.

When the MFC dialog box is created (using the Create, CreateIndirect, or DoModal method inherited from CDialog), a WM_INITDIALOG message is sent and this method is called. It creates an instance of a UserControl control on the dialog box and adjusts the size of the dialog box to accommodate for the size of the user control. Then it hosts the new control in the MFC dialog box.

Override this member function if you need to perform special processing when the dialog box is initialized. For more information on using this method, see CDialog::OnInitDialog.

Header: afxwinforms.h

© 2015 Microsoft