Partager via


CWinFormsDialog::OnInitDialog

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

virtual BOOL OnInitDialog();

Return Value

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.

Remarks

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.

Requirements

Header: afxwinforms.h

See Also

Reference

CWinFormsDialog Class

CDialog::OnInitDialog

UserControl