[This is preliminary documentation and subject to change.]
Displays a message box.
HRESULT MessageBox(
LPCWSTR lpszText, // Pointer to the text to be displayed
LPCWSTR lpszTitle, // Pointer to the title of the box
UINT fuStyle, // Style of the message box
int * piRetval // Pointer to the return value
);
Specify one of the following flags to indicate which buttons appear in the message box:
Flag | Meaning |
---|---|
MB_ABORTRETRYIGNORE | The message box contains three buttons: Abort, Retry, and Ignore. |
MB_OK | The message box contains one button: OK. This is the default. |
MB_OKCANCEL | The message box contains two buttons: OK and Cancel. |
MB_RETRYCANCEL | The message box contains two buttons: Retry and Cancel. |
MB_YESNO | The message box contains two buttons: Yes and No. |
MB_YESNOCANCEL | The message box contains three push buttons: Yes, No, and Cancel. |
Specify one of the following flags to indicate which icon appears in the message box:
Flag | Meaning |
---|---|
MB_ICONEXCLAMATION, MB_ICONWARNING | An exclamation-point icon appears in the message box. |
MB_ICONINFORMATION, MB_ICONASTERISK | An icon consisting of an "I" in a circle appears in the message box. |
MB_ICONQUESTION | A question-mark icon appears in the message box. |
MB_ICONSTOP, MB_ICONERROR, MB_ICONHAND | A stop-sign icon appears in the message box. |
Specify one of the following flags to indicate the default button:
Flag | Meaning |
---|---|
MB_DEFBUTTON1 | The first button is the default button unless one of the other flags in this group is specified as the default. |
MB_DEFBUTTON2 | The second button is the default button. |
MB_DEFBUTTON3 | The third button is the default button. |
MB_DEFBUTTON4 | The fourth button is the default button. |
Specify one of the following flags to indicate the modality of the dialog box:
Flag | Meaning |
---|---|
MB_APPLMODAL | The User must respond to the message box before continuing work in the current window. However, the user can move to the windows of other applications and work in those windows. The default is MB_APPLMODAL if neither MB_SYSTEMMODAL nor MB_TASKMODAL is specified. |
MB_SYSTEMMODAL | All applications are suspended until the user responds to the message box. System-modal message boxes are used to notify the user of serious, potentially damaging errors that require immediate attention and should be used sparingly. |
MB_TASKMODAL | Similar to MB_APPLMODAL, but not useful within a Microsoft Foundation class application. This flag is reserved for a calling application or library that does not have a window handle available. |
In addition, you can specify the following flags:
Flag | Meaning |
---|---|
MB_DEFAULT_DESKTOP_ONLY | The desktop currently receiving input must be a default desktop; otherwise, the function fails. A default desktop is one an application runs on after the user has logged on. |
MB_HELP | Adds a Help button to the message box. Choosing the Help button or pressing F1 generates a Help event. |
MB_RIGHT | The text is right-justified. |
MB_RTLREADING | Displays message and caption text using right-to-left reading order on Hebrew and Arabic systems. |
MB_SETFOREGROUND | The message box becomes the foreground window. Internally, the operating system calls the Win32 SetForegroundWindow function for the message box. |
MB_TOPMOST | The message box is created with the WS_EX_TOPMOST window style. |
MB_SERVICE_NOTIFICATION | TBD |
MB_SERVICE_NOTIFICATION_NT3x | TBD |