-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRegUnit.pas
90 lines (77 loc) · 2.73 KB
/
RegUnit.pas
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
unit RegUnit;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Registry, aspr_api, LMDControl, LMDBaseControl,
LMDBaseGraphicControl, LMDGraphicControl, LMDFill;
type
TRegForm = class(TForm)
Label1: TLabel;
Label2: TLabel;
RegNameEdit: TEdit;
Label3: TLabel;
RegEdit: TEdit;
RegButton: TButton;
CancelButton: TButton;
GroupBox1: TGroupBox;
GroupBox2: TGroupBox;
LMDFill1: TLMDFill;
procedure RegButtonClick(Sender: TObject);
procedure RegEditKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure RegNameEditKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure RegNameEditKeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure RegEditKeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
private
{}
public
{ Public declarations }
end;
var
RegForm: TRegForm;
implementation
{$R *.dfm}
uses MainUnit;
procedure TRegForm.RegButtonClick(Sender: TObject);
begin
If CheckKeyAndDecrypt( PChar(RegEdit.Text), PChar(RegNameEdit.Text), False ) then
Begin
MessageDlg('Registration Key Valid!'+#13+#13+'Congratulations, you have successfully registered the version of QuickTFTP Desktop Pro.', mtInformation, [mbOk], 0);
Config.RegName := RegNameEdit.Text;
Config.RegKey := RegEdit.Text;
ModalResult := MrOK;
PostMessage(self.handle, WM_CLOSE, 0, 0);
end Else MessageDlg('Invalid Registration Key!'+#13+#13+'Make sure you have typed the Regsitration Name and Registration Key exactly'+#13+'as it appears in the email sent to you.', mtWarning, [mbOk], 0);
end;
procedure TRegForm.RegEditKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
If (Length(RegEdit.Text) = 36) and (Length(RegNameEdit.Text) > 0) Then
RegButton.Enabled := True
Else RegButton.Enabled := False;
end;
procedure TRegForm.RegNameEditKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
If (Length(RegEdit.Text) = 36) and (Length(RegNameEdit.Text) > 0) Then
RegButton.Enabled := True
Else RegButton.Enabled := False;
end;
procedure TRegForm.RegNameEditKeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
If (Length(RegEdit.Text) = 36) and (Length(RegNameEdit.Text) > 0) Then
RegButton.Enabled := True
Else RegButton.Enabled := False;
end;
procedure TRegForm.RegEditKeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
If (Length(RegEdit.Text) = 36) and (Length(RegNameEdit.Text) > 0) Then
RegButton.Enabled := True
Else RegButton.Enabled := False;
end;
end.