Displays a message box within one, two, or three push buttons.
This function displays a message box within one, two, or three buttons, and returns the identifier of the button clicked by the user. You can pass dwStyle argument with different values to control the number of buttons, the button titles, and so on.
- Parameters:
-
| hParentWnd | The handle to the hosting main window. |
| pszText | The message text will be displayed in the message box. |
| pszCaption | The caption of the message box. |
| dwStyle | Specifies the contents and behavior of the dialog box. This parameter can be a combination of flags from the following groups of flags. |
To indicate the buttons displayed in the message box, specify one of the following values.
- MB_OK
Create a message box within only one button whose title is "OK".
- MB_OKCANCEL
Create a message box within two buttons whose title are "OK" and "Cancel" respectively.
- MB_YESNO
Create a message box within two buttons whose title are "Yes" and "No" respectively.
- MB_RETRYCANCEL
Create a message box within two buttons whose title are "Retry" and "Cancel" respectively.
- MB_ABORTRETRYIGNORE
Create a message box within three buttons whose title are "Abort", "Retry" and "Ignore" respectively.
- MB_YESNOCANCEL
Create a message box within three buttons whose title are "Yes", "No" and "Cancel" respectively.
- MB_CANCELASBACK
Title "Cancel" replaced with title "Previous".
To display an icon in the message box, specify one of the following values.
- MB_ICONHAND
Display a hand/stop icon in the message box.
- MB_ICONQUESTION
Display a question mark icon in the message box.
- MB_ICONEXCLAMATION
Display a exclamation mark icon in the message box.
- MB_ICONASTERISK
Display an information icon in the message box.
- MB_ICONINFORMATION
Display an information icon in the message box.
- MB_ICONSTOP
Display a hand/stop icon in the message box.
To indicate the default button, specify one of the following values.
- MB_DEFBUTTON1
The first button is the default button.
- MB_DEFBUTTON2
The second button is the default button.
- MB_DEFBUTTON3
The third button is the default button.
To indicate the default text alignment, specify one of the following values.
- MB_ALIGNCENTER
The message box is center aligned.
- MB_ALIGNTOPLEFT
The message box is upper-left aligned.
- MB_ALIGNBTMLEFT
The message box is lower-left aligned.
- MB_ALIGNTOPRIGHT
The message box is upper-right aligned.
- MB_ALIGNBTMRIGHT
The message box is lower-right aligned.
To indicate the default align based on hosting window, specify the following value.
- MB_BASEDONPARENT
A flag indicates that the alignments above are based on the hosting window, not the desktop.
- Returns:
- The identifier of the button clicked by user, can be one of the following values:
- IDOK
The "OK" button clicked.
- IDCANCEL
The "Cancel" or "Previous" button clicked.
- IDABORT
The "Abort" button clicked.
- IDRETRY
The "Retry" button clicked.
- IDIGNORE
The "Ignore" button clicked.
- IDYES
The "Yes" button clicked.
- IDNO
The "No" button clicked.
- Note:
- This function will call GetSysText to translate the button titles to localized text.
- See also:
- GetSysText, DialogBoxIndirectParam