Identifies the window control that is to receive the focus. GetDlgItem member function, which returns a pointer to a CWnd object.
Example See the example for CWnd:: InitModalIndirect Call this member function to initialize a modal dialog object using a dialog-box template that you construct in memory. If it is NULL, the dialog object's parent window is set to the main application window. Return Value Nonzero if the dialog object was created and initialized successfully; otherwise 0. Remarks To create a modal dialog box indirectly, first allocate a global block of memory and fill it with the dialog box template.
Then call the empty CDialog constructor to construct the dialog-box object. Next, call InitModalIndirect to store your handle to the in-memory dialog-box template.
The Windows dialog box is created and displayed later, when the DoModal member function is called. MapDialogRect Call to convert the dialog-box units of a rectangle to screen units.
Remarks Dialog-box units are stated in terms of the current dialog-box base unit derived from the average width and height of characters in the font used for dialog-box text. One horizontal unit is one-fourth of the dialog-box base-width unit, and one vertical unit is one-eighth of the dialog-box base height unit.
The MapDialogRect Windows function uses the appropriate font for this dialog box. The MapDialogRect member function replaces the dialog-box units in lpRect with screen units pixels so that the rectangle can be used to create a dialog box or position a control within a box.
NextDlgCtrl Moves the focus to the next control in the dialog box. OnCancel The framework calls this method when the user clicks Cancel or presses the ESC key in a modal or modeless dialog box.
If you implement the Cancel button in a modeless dialog box, you must override the OnCancel method and call DestroyWindow inside it. Do not call the base-class method, because it calls EndDialog, which will make the dialog box invisible but not destroy it. If he says No, return. If OnInitDialog returns nonzero, Windows sets the input focus to the default location, the first control in the dialog box. The application can return 0 only if it has explicitly set the input focus to one of the controls in the dialog box.
Override this method if you want to perform special processing when the dialog box is initialized. In the overridden version, first call the base class OnInitDialog but ignore its return value. You will typically return TRUE from your overridden method. Windows calls the OnInitDialog function by using the standard global dialog-box procedure common to all Microsoft Foundation Class Library dialog boxes.
It does not call this function through your message map, and therefore you do not need a message map entry for this method. Note You cannot override this method when you use a CFileDialog object in a program that is compiled under Windows Vista or later operating systems. If the dialog box includes automatic data validation and exchange, the default implementation of this method validates the dialog box data and updates the appropriate variables in your application.
Do not call the base-class method, because it calls EndDialog which makes the dialog box invisible but does not destroy it. OnSetFont Specifies the font a dialog-box control will use when drawing text. Remarks The dialog box will use the specified font as the default for all its controls. The dialog editor typically sets the dialog-box font as part of the dialog-box template resource.
PrevDlgCtrl Sets the focus to the previous control in the dialog box. SetDefID Changes the default pushbutton control for a dialog box.