home *** CD-ROM | disk | FTP | other *** search
/ PC Format Collection 48 / SENT14D.ISO / tech / delphi / disk15 / formdll.pak / PASSFORM.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1995-08-24  |  921 b   |  45 lines

  1. unit PassForm;
  2.  
  3. interface
  4.  
  5. uses
  6.   SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
  7.   Forms, Dialogs, StdCtrls, Buttons;
  8.  
  9. type
  10.   TPasswordForm = class(TForm)
  11.     PasswordField: TEdit;
  12.     OKButton: TBitBtn;
  13.     CancelButton: TBitBtn;
  14.     Prompt: TLabel;
  15.   private
  16.     { Private declarations }
  17.   public
  18.     { Public declarations }
  19.   end;
  20.  
  21. var
  22.   PasswordForm: TPasswordForm;
  23.  
  24. function GetPassword(APassword: PChar): WordBool; export;
  25.  
  26. implementation
  27.  
  28. {$R *.DFM}
  29.  
  30. function GetPassword(APassword: PChar): WordBool;
  31. begin
  32.   Result := False;
  33.   PasswordForm := TPasswordForm.Create(Application);
  34.   try
  35.     if PasswordForm.ShowModal = idOK then
  36.       if CompareText(PasswordForm.PasswordField.Text, StrPas(APassword)) = 0 then
  37.         Result := True
  38.       else MessageDlg('Invalid password', mtWarning, [mbOK], 0);
  39.   finally
  40.     PasswordForm.Free;
  41.   end;
  42. end;
  43.  
  44. end.
  45.