TApplication.MessageBox function
Display an message dialog with response buttons.
Declaration
function MessageBox(Text: PChar; Caption: PChar; Flags: LongInt=MB_OK)
: IntegerArguments
Text | The text in the MessageBox. |
Caption | The Caption of the MessageBox. |
Flags | The icon and buttons appearing in the message box. |
Function result
Indicates the pressed button.
Description
The function is used internally to display messages during the handling of
Exceptions, but is also available to application programmers as an
alternative to some of the message dialogs found in the Dialogs
unit.
The function returns an integer value corresponding to the button that was pressed; its value can be determined by reference to the constants [IDOK..IDHELP].
See also
Example: displaymessagebox.pas
Uses Forms, Dialogs, LCLType;
Procedure DisplayMessageBox;
var reply, boxstyle: integer;
begin
with application do begin
boxstyle := MB_ICONQUESTION + MB_YESNO;
reply := MessageBox ('Press either button', 'MessageBoxDemo', boxstyle);
if reply = IDYES then MessageBox ('Yes ', 'Reply',MB_ICONINFORMATION)
else MessageBox ('No ', 'Reply', MB_ICONHAND)
end;An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.
