Skip to main content
A newer version of this page is available. .

dxMessageBox(THandle,string,string,Integer) Method

Invokes a modal message box dialog.

Declaration

function dxMessageBox(AOwnerWndHandle: THandle; const AMessage: string; const ATitle: string; AFlags: Integer): Integer;

Parameters

Name Type Description
AOwnerWndHandle THandle

A handle to the window to which the message dialog box belongs.

AMessage string

Content of the message box.

ATitle string

The caption of the message dialog box. You can pass an empty string as the ATitle parameter to display the predefined “Error” caption.

AFlags Integer

A combination of flags that define available UI elements and the behavior of the message dialog box. Refer to the list of supported flags below.

Returns

Type Description
Integer

An integer value that indicates the button clicked to close the message box. The dxMessageBox function returns 0 if it fails to invoke a message box. Refer to the list of possible return values below.

Remarks

Call this function to invoke a generic dialog box with a message and one or more buttons. The created message dialog box has the mdsMessageBox style.

Skinned Message Box Example

Supported Flags

MB_OK
The message box has only the OK button.
MB_RETRYCANCEL
The message box has two buttons: Retry and Cancel.
MB_YESNO
The message box has two buttons: Yes and No.
MB_YESNOCANCEL
The message box has three buttons: Yes, No, and Cancel.
MB_ABORTRETRYIGNORE
The message box has three buttons: Abort, Retry, and Ignore.
MB_OKCANCEL
The message box has two buttons: OK and Cancel.
MB_DEFBUTTON1
Explicitly defines the first button as default. The first button is default unless the MB_DEFBUTTON2, MB_DEFBUTTON3, or MB_DEFBUTTON4 flag is set.
MB_DEFBUTTON2
Sets the second button as default.
MB_DEFBUTTON3
Sets the third button as default.
MB_DEFBUTTON4
Sets the fourth button as default.
MB_ICONWARNING or MB_ICONEXCLAMATION
The message box displays an exclamation sign icon.
MB_ICONERROR, MB_ICONHAND, or MB_ICONSTOP
The message box displays a stop sign button.
MB_ICONINFORMATION or MB_ICONASTERISK
The message box displays the icon that consists of a lowercase i in a circle.
MB_ICONQUESTION
The message box displays a question sign icon.
MB_RTLREADING
The message box changes the direction of message and caption text to right-to-left.
MB_TOPMOST
The message box has the WS_EX_TOPMOST window style.

Return Values

IDOK
A user clicked the OK button to close the message box.
IDCANCEL
A user clicked the Cancel button to close the message box.
IDABORT
A user clicked the Abort button to close the message box.
IDRETRY
A user clicked the Retry button to close the message box.
IDIGNORE
A user clicked the Ignore button to close the message box.
IDYES
A user clicked the Yes button to close the message box.
IDNO
A user clicked the No button to close the message box.
See Also