-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathunit2.pas
More file actions
104 lines (66 loc) · 2.46 KB
/
unit2.pas
File metadata and controls
104 lines (66 loc) · 2.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
unit Unit2;
{$mode ObjFPC}{$H+}
interface
uses
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ExtCtrls, StdCtrls;
type
{ TForm2 }
TForm2 = class(TForm)
Button1: TButton;
Edit1: TEdit;
Image1: TImage;
Label1: TLabel;
procedure Button1Click(Sender: TObject);
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
private
public
end;
var
Form2: TForm2;
implementation
uses Unit1;
{$R *.lfm}
{ TForm2 }
procedure TForm2.FormCloseQuery(Sender: TObject; var CanClose: Boolean); //Just Hide the Form when closing
begin
CanClose := False; //Cannot Close
Form2.Visible := False; //Hide Form
end;
procedure TForm2.Button1Click(Sender: TObject); //Unblock Button
begin
if (Edit1.Text = Form1.Edit6.Text) AND NOT (Unit1.Tries = 0) then begin //Check Password
Form1.ToggleBox1.Checked := False; //Unset Blocking
ShowMessage('Your Password was correct. All Processes are now unblocked.'); //Display Message
Form2.Visible := False; //Hide Password Input
Edit1.Clear; //Clear Password Field
if Lockdown = True then begin //Check for Lockdown Mode
Form1.TrayIcon1.Visible := True; //Enable TrayIcon
Form1.Enabled := True; //Enable Form
Form1.PageControl1.Enabled := True; //Eable Control
Form1.Button1.Enabled := True; //Eable Control
Form1.StringGrid1.Enabled := True; //Eable Control
LockDown := False; //Disable Lockdown Mode
ShowMessage('Lockdown Mode has been disabled!'); //Show Message
end;
end
else if NOT (Unit1.Tries = 0) then begin //Check remaining Tries
MessageDlg('Advanced Process Blocker', 'Your Password is incorrect.', mtError, [mbOK], ''); //Display Error Message
Form2.Visible := False; //Hide Password Input
Edit1.Clear; //Clear Password Field
if Unit1.Tries > 0 then begin //Check Tries
Unit1.Tries := Unit1.Tries - 1; //Remove 1 Password Try
if Unit1.Tries <> 1 then begin //Spelling Check for Tries and Try
ShowMessage('You have ' + IntToStr(Unit1.Tries) + ' Tries left!'); //Display Message
end
else begin
ShowMessage('You have ' + IntToStr(Unit1.Tries) + ' Try left!'); //Display Message
end;
end;
end
else begin
MessageDlg('Advanced Process Blocker', 'No more Tries left!', mtError, [mbOK], ''); //Display Error Message
Form2.Visible := False; //Hide Password Input
Edit1.Clear; //Clear Password Field
end;
end;
end.