|
EXAMPLE 2
Items
In this example you will learn to
Protection schemes
Flowchart
Brief practice with example 2a
In this example you will learn to:
1. Use the component in a basic protection scheme (Scheme B).
Protection schemes
This example uses the scheme B
Scheme B

It is implemented as shown in the following flowchart:
Flowchart

|
procedure TForm1.FormCreate(Sender: TObject);
begin
DoRegister(False);
end;
procedure TForm1.DoRegister(force:boolean);
var F : TRegForm;
begin
F:=TRegForm.Create(nil); //Create the registration Form
try
if AVLockS41.IsLocal and (force or (keydata.DaysLeft < 15)) then F.ShowModal;
finally
FreeAndNil(F);
end;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
special;
end;
procedure TForm1.special;
var F:TForm2;
begin
if (keydata.Status = Registered) then begin
F:=TForm2.Create(nil);
try
F.showmodal;
finally
freeandnil(F);
end;
end else showmessage('Special Features not allowed. Only available for registered users.');
end;
|
The scheme is similar to Example 1, the only change is that it has eliminated the OnPaint event which exits the application when the the registration status was not registered or authorized period had expired, also added the procedure "special" which is executed with the button "Button1" [Special Features].
What explained about the parameter "force" in the example 1 is also valid in this example.
Version (2a): is the development version, with the utilitarian section including buttons to start the trial period and delete the registration data in order to get back the application to its original status.
Version (2b): is the final release, where the trial period starts automatically and the utilitarian section were removed.
Brief practice with example 2a
From the Delphi IDE open the example 2a (\Examples\2\a)

If you like you could follow the steps of the previous example: run the application, start the trial period, remove the registration, etc.
|