MSGBOX statement
Purpose: MSGBOX creates, displays, and operates a message box.
The message box contains a message and title, plus a combination of icons
and push buttons. The MSGBOX statement does not return a value and
the arguments must not be in parentheses.
Syntax:
MSGBOX Msg$ [, Title$, Buttons_and_Icons]
Parameters:
- Msg$ is a string variable or literal that contains the message to be displayed.
- Title$ is a string variable or literal that contains the title that will appear on the top of the message box.
- Buttons_and_Icons specifies a set of bit flags that determine the contents and behavior of the dialog box. This parameter can be a combination of flags from the following flags.
Flag Value Meaning
MB_OK 0 Default Display OK button only.
MB_DEFBUTTON1 0 Default is first button
MB_APPLMODAL 0 The user must respond to the message
box before continuing work in the
window identified by the hWnd parameter.
However, the user can move to the windows
of other applications and work in those
windows. Depending on the hierarchy of
windows in the application, the user
may be able to move to other windows
within the application. All child windows
of the parent of the message box are
automatically disabled, but popup windows
are not.MB_APPLMODAL is the default
if neither MB_SYSTEMMODAL nor MB_TASKMODAL
is specified.
MB_OKCANCEL 1 Display OK and Cancel buttons.
MB_ABORTRETRYIGNORE 2 Display Abort, Retry, and Ignore buttons.
MB_YESNOCANCEL 3 Display Yes, No, and Cancel buttons.
MB_YESNO 4 Display Yes and No buttons.
MB_RETRYCANCEL 5 Display Retry and Cancel buttons.
MB_ICONSTOP 16 Display Critical Message stop-sign icon.
MB_ICONERROR 16 Display Critical Message stop-sign icon.
MB_ICONHAND 16 Display Critical Message stop-sign icon.
MB_ICONQUESTION 32 Display Warning Query icon.
MB_ICONEXCLAMATION 48 Display Warning Message exclamation-point icon.
MB_ICONWARNING 48 Display Warning Message exclamation-point icon.
MB_ICONASTERISK 64 Display Information Message icon consisting
of a lowercase letter i in a circle.
MB_ICONINFORMATION 64 Display Information Message icon consisting
of a lowercase letter i in a circle.
MB_DEFBUTTON2 256 Second button is default.
MB_DEFBUTTON3 512 Third button is default.
MB_DEFBUTTON4 768 Fourth button is default.
MB_SYSTEMMODAL 4096 Same as MB_APPLMODAL except that the
message box has the WS_EX_TOPMOST style.
Use system-modal message boxes to notify
the user of serious, potentially damaging
errors that require immediate attention
(for example, running out of memory).
This flag has no effect on the user's
ability to interact with windows other
than those associated with hWnd.
MB_TASKMODAL 8192 Same as MB_APPLMODAL except that all the
top-level windows belonging to the current
task are disabled if the hWnd parameter
is NULL. Use this flag when the calling
application or library does not have a
window handle available but still needs
to prevent input to other windows in the
current application without suspending
other applications.
MB_HELP 16384 Adds a Help button to the message box.
Choosing the Help button or pressing F1
generates a Help event.
MB_SETFOREGROUND 65536 The message box becomes the foreground
window. Internally, Windows calls the
SetForegroundWindow function for the
message box.
MB_DEFAULT_DESKTOP_ONLY 131072 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_TOPMOST 262144 MessageBox is WS_EX_TOPMOST style
MB_RIGHT 524288 The text is right-justified.
MB_RTLREADING 1058476 Displays message and caption text using
right-to-left reading order on Hebrew
and Arabic systems.
|
MSGBOX function
Purpose: MSGBOX creates, displays, and operates a message box.
The message box contains a message and title, plus a combination
of icons and push buttons.The MSGBOX function does return a value and
the arguments must be in parentheses.
Syntax:
RetVal% = MSGBOX(Msg$ [, Title$, Buttons_and_Icons])
Parameters:
- RetVal% The return value is zero if there is not enough memory
to create the message box. If the function succeeds, the return value,
is one of the following:
Define Value Meaning
IDOK 1 OK button was selected.
IDCANCEL 2 Cancel button was selected.
IDABORT 3 Abort button was selected.
IDRETRY 4 Retry button was selected.
IDIGNORE 5 Ignore button was selected.
IDYES 6 Yes button was selected.
IDNO 7 No button was selected.
IDCLOSE 8 Close button was selected.
IDHELP 9 Help btton was selected.
If a message box has a Cancel button, the function returns
the IDCANCEL value if either the ESC key is pressed
or the Cancel button is selected. If the message box
has no Cancel button, pressing ESC has no effect.
- Msg$ is a string variable or literal that contains the message to be displayed.
- Title$ is a string variable or literal that contains the title that will appear on the top of the message box.
- Buttons_and_Icons specifies a set of bit flags that determine the contents and behavior of the dialog box. This parameter can be a combination of flags from the following flags.
Flag Value Meaning
MB_OK 0 Default Display OK button only.
MB_DEFBUTTON1 0 Default is first button
MB_APPLMODAL 0 The user must respond to the message
box before continuing work in the
window identified by the hWnd parameter.
However, the user can move to the windows
of other applications and work in those
windows. Depending on the hierarchy of
windows in the application, the user
may be able to move to other windows
within the application. All child windows
of the parent of the message box are
automatically disabled, but popup windows
are not.MB_APPLMODAL is the default
if neither MB_SYSTEMMODAL nor MB_TASKMODAL
is specified.
MB_OKCANCEL 1 Display OK and Cancel buttons.
MB_ABORTRETRYIGNORE 2 Display Abort, Retry, and Ignore buttons.
MB_YESNOCANCEL 3 Display Yes, No, and Cancel buttons.
MB_YESNO 4 Display Yes and No buttons.
MB_RETRYCANCEL 5 Display Retry and Cancel buttons.
MB_ICONERROR 16 Display Critical Message icon.
MB_ICONQUESTION 32 Display Warning Query icon.
MB_ICONEXCLAMATION 48 Display Warning Message icon.
MB_ICONWARNING 48 Display Warning Message icon.
MB_ICONASTERISK 64 Display Information Message icon.
MB_ICONINFORMATION 64 Display Information Message icon.
MB_USERICON 128 Specify the MB_USERICON flag
if you want the message box
to display the icon specified
by the lpszIcon member
MB_DEFBUTTON2 256 Second button is default.
MB_DEFBUTTON3 512 Third button is default.
MB_DEFBUTTON4 768 Fourth button is default.
MB_SYSTEMMODAL 4096 Same as MB_APPLMODAL except that the
message box has the WS_EX_TOPMOST style.
Use system-modal message boxes to notify
the user of serious, potentially damaging
errors that require immediate attention
(for example, running out of memory).
This flag has no effect on the user's
ability to interact with windows other
than those associated with hWnd.
MB_TASKMODAL 8192 Same as MB_APPLMODAL except that all the
top-level windows belonging to the current
task are disabled if the hWnd parameter
is NULL. Use this flag when the calling
application or library does not have a
window handle available but still needs
to prevent input to other windows in the
current application without suspending
other applications.
MB_HELP 16384 Adds a Help button to the message box.
Choosing the Help button or pressing F1
generates a Help event.
MB_SETFOREGROUND 65536 The message box becomes the foreground
window. Internally, Windows calls the
SetForegroundWindow function for the
message box.
MB_DEFAULT_DESKTOP_ONLY 131072 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_TOPMOST 262144 MessageBox is WS_EX_TOPMOST style
MB_RIGHT 524288 The text is right-justified.
MB_RTLREADING 1058476 Displays message and caption text using
right-to-left reading order on Hebrew
and Arabic systems.
|
Example:
DIM i
DO
i = MSGBOX("This is a message", "BCX Demo", 3+64)
SELECT CASE i
CASE 2
MSGBOX "You Pressed CANCEL !", "BCX Demo", 1 : END
CASE 6
MSGBOX "You Pressed YES !", "BCX Demo", 1
CASE 7
MSGBOX "You Pressed NO !" , "BCX Demo", 1
END SELECT
LOOP