MessageBoxIndirectA function (winuser.h)

Creates, displays, and operates a message box. The message box contains application-defined message text and title, any icon, and any combination of predefined push buttons.

Syntax

int MessageBoxIndirectA(
  [in] const MSGBOXPARAMSA *lpmbp
);

Parameters

[in] lpmbp

Type: const LPMSGBOXPARAMS

A pointer to a MSGBOXPARAMS structure that contains information used to display the message box.

Return value

Type: int

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

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 there is not enough memory to create the message box, the return value is zero.

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 lpszText and lpszCaption members of the MSGBOXPARAMS structure 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.

Note

The winuser.h header defines MessageBoxIndirect as an alias which automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.

Requirements

Requirement Value
Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header winuser.h (include Windows.h)
Library User32.lib
DLL User32.dll
API set ext-ms-win-ntuser-dialogbox-l1-1-0 (introduced in Windows 8)

See also

Conceptual

Dialog Boxes

MSGBOXPARAMS

MessageBox

MessageBoxEx

Reference