home *** CD-ROM | disk | FTP | other *** search
- { Password demonstration program. Calls a routine in CHKPWORD.DLL to
- prompt the user for a password. CHKPWORD contains a form in a DLL. }
-
- unit Main;
-
- interface
-
- uses WinTypes, WinProcs, Classes, Graphics, Forms, Controls, StdCtrls,
- ExtCtrls;
-
- type
- TForm1 = class(TForm)
- Edit1: TEdit;
- Label1: TLabel;
- Button1: TButton;
- Bevel1: TBevel;
- GroupBox1: TGroupBox;
- StatusLbl: TLabel;
- procedure Button1Click(Sender: TObject);
- end;
-
- var
- Form1: TForm1;
-
- implementation
-
- uses Dialogs;
-
- {$R *.DFM}
-
- { Import routine from DLL. Takes password to match and returns boolean. }
- function GetPassword(Password: string): Boolean;
- far; external 'CHKPWORD';
-
- { Call password check routine, show status in form caption. }
- procedure TForm1.Button1Click(Sender: TObject);
- begin
- if Edit1.Text = '' then
- begin
- MessageDlg('Enter sample password first', mtInformation, [mbOK], 0);
- Edit1.SetFocus;
- end
- else
- if GetPassword(Edit1.Text) then
- StatusLbl.Caption := 'Verified password'
- else StatusLbl.Caption := 'Invalid password';
- end;
-
- end.
-