The flags parameter of the msgBox method is a numeric expression that is the sum of values specifying the number and type of buttons to display, the icon style to use, the identity of the default button, and the modality.
The flags parameter values and the associated global constants provided by the
Global Constant | Integer Value | Description |
---|---|---|
MsgBox_OK_Only | 0 | Display OK button only |
MsgBox_OK_Cancel | 1 | Display OK and Cancel buttons |
MsgBox_Abort_Retry_Ignore | 2 | Display Abort, Retry, and Ignore buttons |
MsgBox_Yes_No_Cancel | 3 | Display Yes, No, and Cancel buttons |
MsgBox_Yes_No | 4 | Display Yes and No buttons |
MsgBox_Retry_Cancel | 5 | Display Retry and Cancel buttons |
MsgBox_Stop_Icon | 16 | Display Stop icon |
MsgBox_Question_Mark_Icon | 32 | Display Question Mark icon |
MsgBox_Exclamation_Mark_Icon | 48 | Display Exclamation Mark icon |
MsgBox_Information_Icon | 64 | Display Information icon |
MsgBox_Default_First | 0 | First button is the default |
MsgBox_Default_Second | 256 | Second button is the default |
MsgBox_Default_Third | 512 | Third button is the default |
MsgBox_App_Modal | 0 | Application modal (the user must respond to the message box before continuing work in the current application) |
MsgBox_System_Modal | 4096 | System modal (all applications are suspended until the user responds to the message box) |
In this table, the first group of values (0 through 5) describes the number and type of buttons displayed in the dialog. The second group of values (16, 32, 48, and 64) describes the icon style. The third group of values (0, 256, and 512) determines the button that is the default. The fourth group of values (0 and 4096) determines the modality of the message box. The default message box title is the application name.
When adding numbers to create a final value for the flags parameter, use only one number from each group.
For application modal message boxes, the msgBox method displays a maximum of 1024 characters (longer messages are truncated after 1024 characters). Message strings longer than 255 characters with no intervening spaces are truncated after 255 characters. For system modal message boxes, the number of characters that you can display depends on screen resolution and if the string to be displayed is on one or more lines.
The msgBox method breaks lines automatically at the right edge of the dialog. If you want to set line breaks, place a linefeed (ANSI character 10) or CrLf before the first character of the text that is to begin each new line.