-
Notifications
You must be signed in to change notification settings - Fork 33
/
Copy pathHGM.License.pas
94 lines (77 loc) · 1.71 KB
/
HGM.License.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
91
92
93
unit HGM.License;
interface
uses
Vcl.Controls, System.Classes, Winapi.Messages, Winapi.Windows, System.SysUtils,
Vcl.Graphics, Vcl.ExtCtrls, Vcl.Themes, Vcl.Forms, Vcl.ImgList, Vcl.ActnList,
System.SyncObjs, System.Types, System.UITypes, HGM.Controls.PanelExt,
HGM.Common;
type
ThTrueInstance = class(TThread)
procedure Execute; override;
procedure Check;
end;
ThTrue = class(TComponent)
class var
Instance: ThTrueInstance;
private
FIsCreated: Boolean;
FAppGUID: string;
procedure SetAppGUID(const Value: string);
public
constructor Create(AOwner: TComponent); override;
class function GetInstance: ThTrueInstance;
property IsCreated: Boolean read FIsCreated;
published
property AppGUID: string read FAppGUID write SetAppGUID;
end;
procedure Register;
implementation
uses
Math;
procedure Register;
begin
RegisterComponents(PackageName, [ThTrue]);
end;
{ ThTrue }
constructor ThTrue.Create(AOwner: TComponent);
begin
inherited;
FIsCreated := True;
end;
class function ThTrue.GetInstance: ThTrueInstance;
begin
// if not Assigned(Instance) then Instance:=ThTrue.Create();
Result := nil;
end;
procedure ThTrue.SetAppGUID(const Value: string);
begin
FAppGUID := Value;
end;
{ ThTrueInstance }
procedure ThTrueInstance.Check;
begin
Synchronize(
procedure
begin
Halt;
end);
end;
procedure ThTrueInstance.Execute;
var
TS: Cardinal;
begin
TS := GetTickCount + 1000 * 5; //(1000 * 60) * 1;
while TS > GetTickCount do
begin
Sleep(1000);
end;
Terminate;
while not Terminated do
Sleep(1000);
Check;
end;
{
initialization
ThTrue.Instance:=ThTrueInstance.Create(False);
ThTrue.Instance.FreeOnTerminate:=True; }
end.