Microsoft Foundation Classes (mfc.hlp) (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
CWnd::MessageBox
CWnd                                        Up Contents Index Back
──Microsoft Foundation Classes──────────────────────────────────────────────
 
  int MessageBox( const char FAR* lpText,
                  const char FAR* lpCaption = NULL, UINT nType = MB_OK );
 
  Parameter   Description
 
  <lpText>    Points to a CString or null-terminated string containing the
              message to be displayed.
 
  <lpCaption> Points to a CString or null-terminated string to be used for
              the message-box caption. If <lpCaption> is NULL, the default
              caption "Error" is used.
 
  <nType>     Specifies the contents of the message box. It can be a
              combination of the following values:
 
              Value                 Meaning
 
              MB_ABORTRETRYIGNORE   Message box contains three push
                                    buttons: Abort, Retry, and Ignore.
 
              MB_APPLMODAL          The user must respond to the message
                                    box before continuing work in the
                                    CWnd. However, the user can move to
                                    the windows of other applications and
                                    work in those windows. MB_APPLMODAL is
                                    the default if MB_SYSTEMMODAL is not
                                    specified.
 
              MB_DEFBUTTON1         First button is the default. Note that
                                    the first button is always the default
                                    unless MB_DEFBUTTON2 or MB_DEFBUTTON3
                                    is specified.
 
              MB_DEFBUTTON2         Second button is the default.
 
              MB_DEFBUTTON3         Third button is the default.
 
              MB_ICONEXCLAMATION    An exclamation-point icon appears in
                                    the message box.
 
              MB_ICONINFORMATION    An icon consisting of a lowercase "i"
                                    in a circle appears in the message
                                    box.
 
              MB_ICONQUESTION       A question-mark icon appears in the
                                    message box.
 
              MB_ICONSTOP           A stop-sign icon appears in the
                                    message box.
 
              MB_OK                 Message box contains one push button:
                                    OK.
 
              MB_OKCANCEL           Message box contains two push buttons:
                                    OK and Cancel.
 
              MB_RETRYCANCEL        Message box contains two push buttons:
                                    Retry and Cancel.
 
              MB_SYSTEMMODAL        All applications are suspended until
                                    the user responds to the message box.
                                    Unless the application specifies
                                    MB_ICONSTOP, the message box does not
                                    become modal until after it is
                                    created; consequently, the parent
                                    window and other windows continue to
                                    receive messages resulting from its
                                    activation. System-modal message boxes
                                    are used to notify the user of
                                    serious, potentially damaging errors
                                    that require immediate attention (for
                                    example, running out of memory).
 
              MB_YESNO              Message box contains two push buttons:
                                    Yes and No.
 
              MB_YESNOCANCEL        Message box contains three push
                                    buttons: Yes, No, and Cancel.
 
  Remarks
 
  Creates and displays a window that contains an application-supplied
  message and caption, plus a combination of the predefined icons and push
  buttons described in the preceding list.
 
  When a system-modal message box is created to indicate that the system
  is low on memory, do not take the strings passed as <lpText> and
  <lpCaption> from a resource file, since an attempt to load the resource
  may fail.
 
  When an application calls the MessageBox member function and specifies
  the MB_ICONSTOP and MB_SYSTEMMODAL flags for <nType>, Windows will
  display the resulting message box regardless of available memory. When
  these flags are specified, Windows limits the length of the message-box
  text to one line.
 
  Return Value
 
  Specifies the outcome of the function. It is 0 if there is not enough
  memory to create the message box. Otherwise, it is one of the following
  menu-item values returned by the message box:
 
  Value      Meaning
 
  IDABORT    Abort button pressed
 
  IDCANCEL   Cancel button pressed
 
  IDIGNORE   Ignore button pressed
 
  IDNO       No button pressed
 
  IDOK       OK button pressed
 
  IDRETRY    Retry button pressed
 
  IDYES      Yes button pressed
 
  If a message box has a Cancel button, the IDCANCEL value will be
  returned if either the ESC key or the Cancel button is pressed. If the
  message box has no Cancel button, pressing the ESC key has no effect.
 
  See Also
 
  ::MessageBox
 
 
                                     -♦-