unit MessageDlg;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

// BeginExample: MessageDlg
// Routine: Dialogs.MessageDlg

// BeginCode
{
This example uses a button on a form. When the user clicks
the button, a message box appears, asking if the user wants
to exit the application. If the user chooses Yes, another
dialog box appears informing the user the application is
about to end. When user chooses OK or closes the dialog box,
the application ends.
} 
procedure TForm1.Button1Click(Sender: TObject);
begin
  if Dialogs.MessageDlg('Welcome to my Delphi application.  Exit now?',
    mtConfirmation, [mbYes, mbNo], 0, mbYes) = mrYes then
  begin
    Dialogs.MessageDlg('Exiting the Delphi application.', mtInformation,
      [mbOk], 0, mbOk);
    Close;
  end;
end;
// EndCode
// EndExample: MessageDlg
end.
