ShellMessageBoxA function (shellapi.h)

[ShellMessageBox is available for use in the operating systems specified in the Requirements section. It may be altered or unavailable in subsequent versions.]

ShellMessageBox is a special instance of MessageBox that provides the option of using the owner window's title as the title of the message box.

Syntax

int ShellMessageBoxA(
  [in] HINSTANCE hAppInst,
  [in] HWND      hWnd,
  [in] LPCSTR    lpcText,
  [in] LPCSTR    lpcTitle,
  [in] UINT      fuStyle,
       ...       
);

Parameters

[in] hAppInst

Type: HINSTANCE

The handle of the module from which to load a string resource named in pszTitle. If pszTitle does not name a string resource, this parameter is ignored. This value must be valid if pszMsg or pszTitle is a resource ID.

[in] hWnd

Type: HWND

A handle to the owner window of the message box to be created. If this variable is not NULL, the title of the owner window is used as the title of the message box.

[in] lpcText

Type: LPCTSTR

A pointer to a null-terminated string that contains either the message to be displayed or a resource ID specifying where the message is to be retrieved from.

[in] lpcTitle

Type: LPCTSTR

A pointer to a null-terminated string that contains the dialog box title or a resource ID specifying where the title is to be retrieved. If both this parameter and hWnd are NULL, no title is displayed. If this parameter points to a loadable resource formed with the MAKEINTRESOURCE macro, it overrides hWnd as the title.

[in] fuStyle

Type: UINT

Specifies the contents and behavior of the dialog box. For possible values, see MessageBox.

...

A variable argument list that is combined with pszMsg to form the full text displayed in the message box.

Return value

Type: int

An integer value indicating a button that was pressed in the message box. For specific values, see MessageBox.

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

Remarks

Note

The shellapi.h header defines ShellMessageBox 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 XP [desktop apps only]
Minimum supported server Windows Server 2003 [desktop apps only]
Target Platform Windows
Header shellapi.h
Library Shlwapi.lib
DLL Shlwapi.dll

See also

MAKEINTRESOURCE

MessageBox