Purpose |
Display a message box containing a text
| ||||||||||||||
Syntax |
MSGBOX txt$ [, [style%], title$] ? txt$ [, [style%], title$] | ||||||||||||||
Remarks |
The MSGBOX statement comprises the following elements: | ||||||||||||||
txt$ |
Text to display within the message box. | ||||||||||||||
style& |
Optional parameter which determines the appearance of the message box. Some styles may be combined (OR'ed together) to specify the button and icon displayed in the message box. If style& is omitted, PowerBASIC substitutes %MB_OK. The following are some of the more common styles used with the MSGBOX statement (also see the MSGBOX function for more information):
Additional styles may be found in WIN32API.INC, in the section prefixed with %MB_. If you are interested in which button the user selects, use a MSGBOX function rather than a MSGBOX statement. | ||||||||||||||
title$ |
Determines the title to be displayed in the caption of the message box. If title$ is not specified, "PowerBASIC" is used automatically. The MSGBOX statement may be represented by the query (?) character as a shortcut. This is similar to the behavior in the PowerBASIC Console Compiler (PB/CC), where the query character is recognized as a synonym for the PRINT statement. This can simplify the creation of certain test code, since the query character provides similar functionality in both compilers. | ||||||||||||||
Restrictions |
Strings displayed by the MSGBOX function are displayed only up to the first $NUL character, if any. | ||||||||||||||
See also |
|||||||||||||||
Example |
MSGBOX "Got here, hit OK to continue",, "Title of subroutine 123" MSGBOX "Current value of X% is: " & STR$(x%) MSGBOX "Paused, click OK to continue!" MSGBOX "Click OK to reboot the universe…", %MB_TASKMODAL OR %MB_ICONERROR, "Reality has crashed!" |