home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 1998 April A
/
Pcwk4a98.iso
/
PROGRAM
/
DELPHI16
/
Ypasswrd
/
YRMAIN.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1995-11-28
|
3KB
|
103 lines
unit Yrmain;
interface
uses
SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
Forms, Dialogs, Buttons, StdCtrls, Spin, YRPasswd ;
type
TForm1 = class(TForm)
Button1: TButton;
BitBtn1: TBitBtn;
Label1: TLabel;
Label2: TLabel;
Edit1: TEdit;
Edit2: TEdit;
LoginLabel: TLabel;
Label3: TLabel;
Label4: TLabel;
Edit3: TEdit;
Edit4: TEdit;
Mypswd: TYRPasswd;
procedure BitBtn1Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
begin
Hide ;
If not Mypswd.GetPassword then
Begin
If not Mypswd.ExistDll
then MessageDlg('File PASSWORD.DLL is missing' + #13#10 + #13#10 +
'You are not authorized to use this program !', mtInformation,[mbOk], 0)
else MessageDlg('BAD PASSWORD....', mtInformation,[mbOk], 0);
Form1.Color := clRed ;
LoginLabel.Visible := False ;
End else
Begin
MessageDlg('GOOD PASSWORD....', mtInformation,[mbOk], 0);
Form1.Color := clGreen ;
LoginLabel.Visible := True ;
End ;
Show ;
LoginLabel.Visible := Mypswd.OkLogin ;
Edit1.Text := Mypswd.UserName ;
Edit2.Text := IntToStr(Mypswd.UserLevel) ;
Edit3.Text := Mypswd.IniName ;
Edit4.Text := Mypswd.SectionName ;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
If not Mypswd.GetPassword then
Begin
If not Mypswd.ExistDll
then MessageDlg('File PASSWORD.DLL is missing' + #13#10 + #13#10 +
'You are not authorized to use this program !', mtInformation,[mbOk], 0)
else MessageDlg('BAD PASSWORD....', mtInformation,[mbOk], 0);
Application.Terminate ;
End else
Begin
MessageDlg('GOOD PASSWORD....', mtInformation,[mbOk], 0);
Form1.Color := clGreen ;
Edit1.Text := Mypswd.UserName ;
Edit2.Text := IntToStr(Mypswd.UserLevel) ;
Edit3.Text := Mypswd.IniName ;
Edit4.Text := Mypswd.SectionName ;
End ;
end;
procedure TForm1.BitBtn1Click(Sender: TObject);
begin
Close ;
end;
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
if MessageDlg('Close application ?', mtConfirmation,
[mbYes, mbNo], 0) = mrYes then
begin
Action := caFree ;
Mypswd.FreeDllPassword ;
end
else
Action := caNone;
end;
end.