[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] | Reference for unit 'InterfaceBase' (#lcl)

# TWidgetSet.MessageBox

Displays a modal dialog message box.

## Declaration

Source position: winapih.inc line 199

`public function TWidgetSet.MessageBox(`
`hWnd: HWND;`
`lpText: PChar;`
`lpCaption: PChar;`
`uType: Cardinal = MB_OK`
`):Integer; virtual;`

## Arguments

`hWnd` |  | The handle of the window that owns the MessageBox.
`lpText` |  | The text displayed in the MessageBox.
`lpCaption` |  | The caption of the MessageBox.
`uType` |  | Style flags specifying the shown buttons etc.

## Function result

The pressed button, or zero on failure.

## Description

The MessageBox function displays a modal dialog with the given text, caption, icon and buttons.

uType is a combination of flags from the following lists.

The shown buttons are selected by one of:

MB_ABORTRETRYIGNORE
  Abort, Retry, and Ignore.
MB_CANCELTRYCONTINUE
  Cancel, Try Again, Continue. Use this message box type instead of MB_ABORTRETRYIGNORE.
MB_OK
  OK.
MB_OKCANCEL
  OK and Cancel.
MB_RETRYCANCEL
  Retry and Cancel.
MB_YESNO
  Yes and No.
MB_YESNOCANCEL
  Yes, No, and Cancel.

Add MB_HELP for an Help button. When the user clicks the Help button or presses F1, the owner window receives a WM_HELP message.

An icon can be added by one of:

MB_ICONEXCLAMATION, MB_ICONWARNING
  Exclamation point icon
MB_ICONINFORMATION, MB_ICONASTERISK
  The letter "i" in a circle
MB_ICONQUESTION
  Question mark icon
MB_ICONSTOP, MB_ICONERROR, MB_ICONHAND
  Stop sign icon

The default button number, activated when the user presses Enter, can be indicated by one of:

- MB_DEFBUTTON1
- MB_DEFBUTTON2
- MB_DEFBUTTON3
- MB_DEFBUTTON4

Other Windows MessageBox-specific options are not (yet) implemented on other platforms.

The function result corresponds to the button pressed:

- IDABORT
- IDCANCEL
- IDCONTINUE
- IDIGNOE
- IDNO
- IDOK
- IDRETRY
- IDTRYAGAIN
- IDYES