HOWTO: Change or Set the Default Push Button in a Dialog BoxID: Q67655
|
The default push button in a dialog box is defined to be the button that is pressed when the user chooses the ENTER key, provided that the input focus is not on another button in the dialog box. The default push button is visually distinguished from other buttons by a thick dark border. This article describes how to change the default push button.
To change the default push button, perform the following three steps:
// Reset the current default push button to a regular button.
SendDlgItemMessage(hDlg, <ID of current default push button>,
BM_SETSTYLE, BS_PUSHBUTTON, (LONG)TRUE);
// Update the default push button's control ID.
SendMessage(hDlg, DM_SETDEFID, <ID of new default push button>,
0L);
// Set the new style.
SendDlgItemMessage(hDlg, <ID of new default push button>,
BM_SETSTYLE, BS_DEFPUSHBUTTON, (LONG)TRUE);
Keywords : kbButton kbCtrl kbDlg kbNTOS kbGrpUser kbWinOS
Version :
Platform :
Issue type : kbhowto
Last Reviewed: March 6, 1999