Export (0) Print
Expand All
Expand Minimize
0 out of 1 rated this helpful - Rate this topic

ShellMessageBox function

[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.


int ShellMessageBox(
  _In_  HINSTANCE hInst,
  _In_  HWND hWnd,
  _In_  LPCTSTR pszMsg,
  _In_  LPCTSTR pszTitle,
  _In_  UINT fuStyle,
  _In_   ...


hInst [in]


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.

hWnd [in]

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.

pszMsg [in]


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.

pszTitle [in]


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.

fuStyle [in]

Type: UINT

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

... [in]

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.


Minimum supported client

Windows XP [desktop apps only]

Minimum supported server

Windows Server 2003 [desktop apps only]

End of client support

Windows XP with SP2

End of server support

Windows Server 2003







Unicode and ANSI names

ShellMessageBoxW (Unicode) and ShellMessageBoxA (ANSI)

See also




Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

© 2014 Microsoft. All rights reserved.