MessageBoxExA function

Creates, displays, and operates a message box. The message box contains an application-defined message and title, plus any combination of predefined icons and push buttons. The buttons are in the language of the system user interface.

Currently MessageBoxEx and MessageBox work the same way.

Syntax

int MessageBoxExA(
  HWND   hWnd,
  LPCSTR lpText,
  LPCSTR lpCaption,
  UINT   uType,
  WORD   wLanguageId
);

Parameters

hWnd

Type: HWND

A handle to the owner window of the message box to be created. If this parameter is NULL, the message box has no owner window.

lpText

Type: LPCTSTR

The message to be displayed.

lpCaption

Type: LPCTSTR

The dialog box title. If this parameter is NULL, the default title Error is used.

uType

Type: UINT

The contents and behavior of the dialog box. For information on the supported flags, see MessageBox.

wLanguageId

Type: WORD

The language for the text displayed in the message box button(s). Specifying a value of zero (0) indicates to display the button text in the default system language. If this parameter is MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), the current language associated with the calling thread is used.

To specify a language other than the current language, use the MAKELANGID macro to create this parameter. For more information, see MAKELANGID.

Return Value

Type: int

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.

If the function fails, the return value is zero. To get extended error information, call GetLastError.

If the function succeeds, the return value is one of the following menu-item values.

Return code/value Description
IDABORT
3
The Abort button was selected.
IDCANCEL
2
The Cancel button was selected.
IDCONTINUE
11
The Continue button was selected.
IDIGNORE
5
The Ignore button was selected.
IDNO
7
The No button was selected.
IDOK
1
The OK button was selected.
IDRETRY
4
The Retry button was selected.
IDTRYAGAIN
10
The Try Again button was selected.
IDYES
6
The Yes button was selected.

Remarks

When you use a system-modal message box to indicate that the system is low on memory, the strings pointed to by the lpText and lpCaption parameters should not be taken from a resource file because an attempt to load the resource may fail.

If you create a message box while a dialog box is present, use a handle to the dialog box as the hWnd parameter. The hWnd parameter should not identify a child window, such as a control in a dialog box.

Requirements

   
Windows version Windows 2000 Professional [desktop apps only] Windows 2000 Server [desktop apps only]
Target Platform Windows
Header winuser.h (include Windows.h)
Library User32.lib
DLL User32.dll

See Also

Conceptual

Dialog Boxes

MAKELANGID

MessageBeep

MessageBox

MessageBoxIndirect

Other Resources

Reference

SetForegroundWindow