MSGBOXPARAMS Structure
Type MSGBOXPARAMS
cbSize As Long
hwndOwner As Long
hInstance As Long
lpszText As String
lpszCaption As String
dwStyle As Long
lpszIcon As Long
dwContextHelpId As Long
lpfnMsgBoxCallback As Long
dwLanguageId As Long
End Type
Description & Usage
The MSGBOXPARAMS structure stores the options used to create a message box. The information held by the structure specifies numerous settings used to determine the presentation and functionality of the message box.
Visual Basic-Specific Issues
To specifiy a pointer to the MsgBoxCallback callback function for the lpfnMsgBoxCallback data member, a dummy function must be used. Because the AddressOf operator is only valid inside a function call's argument list, a program-defined dummy function that simply returns the value passed to it is necessary to set the data member. For an example of such a dummy function, see the example for the MessageBoxIndirect function.
Data Members
- cbSize
- The size in bytes of the structure.
- hwndOwner
- A handle to the window which owns the message box.
- hInstance
- A handle to the instance of the application calling the function.
- lpszText
- The text to display in the body of the message box.
- lpszCaption
- The text to display in the title bar of the message box.
- dwStyle
- A combination of various flags specifying the behavior and appearance of the message box. The available flags are grouped according to function. If no flags in a certain group are specified, the default is used.
Use one of the following flags to specify which buttons to display in the message box. (Note that MB_HELP can be combined with any of the other flags.)
- MB_ABORTRETRYIGNORE
- The message box contains the Abort, Retry, and Ignore buttons.
- MB_CANCELTRYCONTINUE
- Windows 2000: The message box contains the Cancel, Try Again, and Continue buttons. This is meant to replace the MB_ABORTRETRYIGNORE flag.
- MB_HELP
- Windows 95, 98, NT 4.0 or later, 2000: Add the Help button to the message box. When the user clicks the Help button, the WM_HELP message is sent to the owner of the message box (specified by the hWnd parameter). This flag can only be used by combining it with another button flag (i.e., the Help button cannot appear alone).
- MB_OK
- The message box contains the OK button. This is the default.
- MB_OKCANCEL
- The message box contains the OK and Cancel buttons.
- MB_RETRYCANCEL
- The message box contains the Retry and Cancel buttons.
- MB_YESNO
- The message box contains the Yes and No buttons.
- MB_YESNOCANCEL
- The message box contains the Yes, No, and Cancel buttons.
Use one of the following flags to specify which icon to display in the message box:
- MB_ICONASTERISK, MB_ICONINFORMATION
- Display the information icon: a lowercase letter "i" inside a blue circle.
- MB_ICONERROR, MB_ICONHAND, MB_ICONSTOP
- Display the stop-sign icon in the message box.
- MB_ICONEXCLAMATION, MB_ICONWARNING
- Display the exclamation-point icon in the message box.
- MB_ICONQUESTION
- Display the question-mark icon in the message box.
- MB_USERICON
- Use the icon specified by the lpszIcon data member instead of a predefined system icon.
Use one of the following flags to specify which button is selected by default:
- MB_DEFBUTTON1
- The first button is the default. This is the default.
- MB_DEFBUTTON2
- The second button is the default.
- MB_DEFBUTTON3
- The third button is the default.
- MB_DEFBUTTON4
- The fourth button is the default.
Use one of the following flags to specify the modality of the message box:
- MB_APPLMODAL
- The message box is application-modal. The user cannot switch to any other windows owned by the application until he or she first closes the message box. This is the default.
- MB_SYSTEMMODAL
- The message box is system-modal. The user cannot switch to any other windows until he or she first closes the message box.
- MB_TASKMODAL
- The message box is thread-modal. The user cannot switch to any other windows owned by the calling thread until he or she first closes the message box.
Use zero or more of the following flags to specify other options for the message box:
- MB_DEFAULT_DESKTOP_ONLY
- Windows NT, 2000: Same as MB_SERVICE_NOTIFICATION, except that the system will display the message box only on the interactive window station's default desktop.
- MB_RIGHT
- The text in the message box is right-justified.
- MB_RTLREADING
- Display the message text and caption using right-to-left reading order if desired by the system language.
- MB_SETFOREGROUND
- Make the message box the foreground window.
- MB_TOPMOST
- Make the message box a topmost window.
- MB_SERVICE_NOTIFICATION
- Windows NT 4.0 or later, 2000: The calling thread is a service notifying the user of an event. The hWnd parameter must be 0.
- MB_SERVICE_NOTIFICATION_NT3X
- Windows NT 3.1 through 3.51: Same as MB_SERVICE_NOTIFICATION. The value of this flag changed with the release of NT 4.0.
- lpszIcon
- The icon resource to use for the message box's icon. This can be specified either by an integer resource identifier or by a pointer to a string equal to the resource's name. Either way, the resource must be owned by the instance specified by hInstance.
- dwContextHelpId
- The help context ID which identifies the appropriate help topic to display if the user clicks the Help button. This information is passed to the callback function specified by lpfnMsgBoxCallback.
- lpfnMsgBoxCallback
- A pointer to the MsgBoxCallback callback function to process help events for the message box. This function is invoked whenever the user clicks the Help button. If this is 0 and the user clicks the Help button, a WM_HELP message is sent to the message box's owner.
- dwLanguageId
- The language ID, retrieved by the MAKELANGID macro, which identifies the language to use to display the message box's buttons. This language must already be installed on the computer.
Constant Definitions
Const MB_ABORTRETRYIGNORE = &H2
Const MB_CANCELTRYCONTINUE = &H2
Const MB_HELP = &H4000
Const MB_OK = &H0
Const MB_OKCANCEL = &H1
Const MB_RETRYCANCEL = &H5
Const MB_YESNO = &H4
Const MB_YESNOCANCEL = &H3
Const MB_ICONASTERISK = &H40
Const MB_ICONERROR = &H10
Const MB_ICONEXCLAMATION = &H30
Const MB_ICONHAND = &H10
Const MB_ICONINFORMATION = &H40
Const MB_ICONQUESTION = &H20
Const MB_ICONSTOP = &H10
Const MB_ICONWARNING = &H30
Const MB_USERICON = &H80
Const MB_DEFBUTTON1 = &H0
Const MB_DEFBUTTON2 = &H100
Const MB_DEFBUTTON3 = &H200
Const MB_DEFBUTTON4 = &H300
Const MB_APPLMODAL = &H0
Const MB_SYSTEMMODAL = &H1000
Const MB_TASKMODAL = &H2000
Const MB_DEFAULT_DESKTOP_ONLY = &H20000
Const MB_RIGHT = &H80000
Const MB_RTLREADING = &H100000
Const MB_SETFOREGROUND = &H10000
'Const MB_TOPMOST = ???
'Const MB_SERVICE_NOTIFICATION = ???
'Const MB_SERVICE_NOTIFICATION_NT3X = ???
Used By
MessageBoxIndirect
Back to the Structure list.
Back to the Reference section.
Last Modified: February 11, 2000
This page is copyright © 2000 Paul Kuliniewicz.
Copyright Information Revised October 29, 2000
Go back to the Windows API Guide home page.
E-mail: vbapi@vbapi.com Send Encrypted E-Mail
This page is at http://www.vbapi.com/ref/m/msgboxparams.html