The IMessageBox class displays message boxes that are compliant with the Windows Interface Guidelines for Software Design style guide on Windows, the Common User Access (CUA) style guide on OS/2, and the Motif style guide on AIX.
You can construct and destruct objects of this class. You cannot copy or assign IMessageBox objects because both the copy constructor and assignment operator are private functions.
![]() |
public:
virtual ~IMessageBox()
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
IMessageBox(IWindow* owner)
You can only construct objects of this class by specifying an object of the class IWindow.
To display help for a message box, ensure that owner is nonzero, and that the owner specified is associated with an IHelpWindow object.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
A message window is not displayed when you construct an IMessageBox object. When you show the message window, you can specify its message text, push buttons, icon, and other specifics.
![]() |
Shows a message box. The returned value is an enumerator provided by Response.
public:
virtual IMessageBox::Response show( const IResourceId& message, const Style& style, unsigned long helpId = 0 )
Windows | OS/2 | AIX |
Yes | Yes | Yes |
public:
virtual IMessageBox::Response show( const char* message, Severity severity, unsigned long helpId = 0 )
Windows | OS/2 | AIX |
Yes | Yes | Yes |
public:
virtual IMessageBox::Response show( const char* message, const Style& style, unsigned long helpId = 0 )
Windows | OS/2 | AIX |
Yes | Yes | Yes |
public:
virtual IMessageBox::Response show( const IBaseErrorInfo& error, unsigned long helpId = 0 )
Windows | OS/2 | AIX |
Yes | Yes | Yes |
public:
virtual IMessageBox::Response show( const IResourceId& message, Severity severity, unsigned long helpId = 0 )
Windows | OS/2 | AIX |
Yes | Yes | Yes |
public:
virtual IMessageBox::Response show( const IException& exception, unsigned long helpId = 0 )
Windows | OS/2 | AIX |
Yes | Yes | Yes |
IMessageBox defines a set of objects of the nested class IMessageBox::Style. You can use these styles with versions of the function show to identify the push buttons and icon to be displayed on the message box, the modality of the message box, and whether the user is allowed to move the message box.
![]() |
public:
static const Style abortRetryIgnoreButton
Specifies the message box should contain the Abort, Retry, and Ignore push buttons.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
static const Style applicationModal
Specifies that the message box be application-modal.
This is the default style.
Note:
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
static const Style cancelButton
Specifies the message box should contain a Cancel push button.
Windows | OS/2 | AIX |
Ignored | Yes | Yes |
Specifies the message box should contain an OK push button because Windows does not have a message box with a Cancel button.
![]() |
public:
static const Style defButton1
Specifies that the default selection for the message box should be the first push button. This is the default style.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
static const Style defButton2
Specifies that the default selection for the message box should be the second push button.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
static const Style defButton3
Specifies that the default selection for the message box should be the third push button.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
static const Style enterButton
Specifies the message box should contain an Enter push button.
Windows | OS/2 | AIX |
Ignored | Yes | Yes |
Specifies the message box should contain an OK push button because Windows does not have a message box with an Enter button.
![]() |
public:
static const Style enterCancelButton
Specifies the message box should contain both Enter and Cancel push buttons.
Windows | OS/2 | AIX |
Ignored | Yes | Yes |
Specifies the message box should contain OK and Cancel push buttons because Windows does not have a message box with Enter and Cancel buttons.
![]() |
public:
static const Style errorIcon
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
static const Style informationIcon
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
static const Style moveable
Specifies that the user can move the message box. This style gives the message box a title bar.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
static const Style noIcon
Specifies the message box should contain no icon.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
static const Style okButton
Specifies the message box should contain an OK push button.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
static const Style okCancelButton
Specifies the message box should contain both OK and Cancel push buttons.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
static const Style queryIcon
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
static const Style retryCancelButton
Specifies the message box should contain both Retry and Cancel push buttons.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
static const Style systemModal
Specifies that the message box be system modal. This prevents the user from interacting with any other window, including those of other applications, until dismissing the message box.
Windows | OS/2 | AIX |
Ignored | Yes | Yes |
![]() |
public:
static const Style warningIcon
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
static const Style yesNoButton
Specifies the message box should contain both Yes and No push buttons.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
static const Style yesNoCancelButton
Specifies the message box should contain Yes, No, and Cancel push buttons.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
Use these functions to set the text displayed in the title bar of the message box, or if the message box has no title bar, to set the text displayed above the message text.
![]() |
Sets the message box's title.
public:
virtual IMessageBox& setTitle(const IResourceId& title)
Windows | OS/2 | AIX |
Yes | Yes | Yes |
public:
virtual IMessageBox& setTitle(const char* title)
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
enum Response { enter, ok, cancel, abort, retry, ignore, yes, no, unknown }
These enumerators identify the push button used by the user to dismiss a message box.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
The Windows platform does not support Enter push buttons in message boxes. The enter response is not applicable to that environment.
![]() |
enum Severity { information, warning, action, critical, catastrophic }
Use these enumerators to specify the different severity levels of a message box:
Windows | OS/2 | AIX |
Yes | Yes | Yes |