Windows API Reference

MessageBoxW Function

Signature:

int MessageBoxW(
  [in, optional] HWND    hWnd,
  [in, optional] LPCWSTR lpText,
  [in, optional] LPCWSTR lpCaption,
  [in]           UINT    uType
);

Parameters

Return Value

Remarks

The MessageBoxW function creates, displays, and operates a message box. A message box is a dialog box that displays a specific message to the user and prompts for a response.

The uType parameter determines the buttons displayed, the icon displayed, which control has the keyboard focus, and the modality of the message box. See the Message Box Flags documentation for a complete list of options.

Requirements

Header: winuser.h (include windows.h)
Library: User32.lib
DLL: User32.dll

See Also

Example

This example displays a simple message box with an OK button.

#include <windows.h>

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
    MessageBoxW(NULL, L"This is a simple message box.", L"My Application", MB_OK | MB_ICONINFORMATION);
    return 0;
}