unit Unit1;

interface

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

type
  TForm1 = class(TForm)
    AHMPasswordDlg1: TAHMPasswordDlg;
    Button1: TButton;
    Button2: TButton;
    Label1: TLabel;
    Label2: TLabel;
    procedure Button1Click(Sender: TObject);
    procedure AHMPasswordDlg1Retry(Sender: TObject; RetriesLeft: Integer);
    procedure AHMPasswordDlg1AfterRetries(Sender: TObject);
    procedure AHMPasswordDlg1RightPassword(Sender: TObject);
    procedure AHMPasswordDlg1WrongPassword(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);
begin
  if AHMPasswordDlg1.Execute then showmessage('Right');
end;

procedure TForm1.AHMPasswordDlg1Retry(Sender: TObject;
  RetriesLeft: Integer);
begin
  Showmessage('You have entered the wrong password. You are allowed to enter it '+Inttostr(RetriesLeft)+' more time(s)');
end;

procedure TForm1.AHMPasswordDlg1AfterRetries(Sender: TObject);
begin
  Showmessage('Please consult the administrator for your security rights');
  Halt;
end;

procedure TForm1.AHMPasswordDlg1RightPassword(Sender: TObject);
begin
  showmessage('You have been granted access to the secure area');
end;

procedure TForm1.AHMPasswordDlg1WrongPassword(Sender: TObject);
begin
  showmessage('You have not been granted access to the secure area');
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
  close;
end;

end.
