msgBox

Syntax

int msgBox(int level, string titleBarText, string dialogText)

Arguments

level
The type of message box that you want to display.
titleBarText
The text that will appear in the title bar of the message box window.
dialogText
The text that will appear in the dialog section of the message box window.

Return

The ID of the button that the user clicked on (eg IDYES, IDNO, IDCANCEL etc.)

Description

This function calls a message box with a user-defined title bar text, a user-defined dialog text and at least one pushbutton, which depends on the dialog level set. The following levels can be set:
MB_ICONERROR Places an error icon in the message box
MB_ICONQUESTION Places a YESNO question icon in the message box
MB_ICONWARNING Places a warning sign icon in the message box
MB_ICONINFORMATION Places an Info icon in the message box
MB_OK Places one pushbutton: OK
MB_OKCANCEL Places two pushbuttons: OK and Cancel
MB_ABORTRETRYIGNORE Places three pushbuttons: Abort, Retry and Ignore
MB_YESNOCANCEL Places three pushbuttons: Yes, No and Cancel
MB_YESNO Places two pushbuttons: Yes and No
MB_RETRYCANCEL Places two pushbuttons: Retry and Cancel
MB_APPLMODAL Default: OK button, title bar and dialog text
MB_SYSTEMMODAL Places a windows logo in the title bar
These levels can be combined by adding the symbol | between them. Note that the title bar text does not support escape sequences nor substrings.

Example

msgBox ( MB_YESNO, "Title bar text", "Dialog text" );
msgBox ( MB_ICONQUESTION | MB_YESNOCANCEL, "Poppy's Filters Question", "Apply the filter?" );
msgBox ( MB_ICONINFORMATION | MB_SYSTEMMODAL | MB_OK, "Filtermania", "This will last for hours" );

Also see

Info, Warn, Error

Comments

Everyone can add his comments about his experiences with this function here. Tips for using it are welcome, too.