|
EXAMPLE 4
Items
In this example you will learn to
Protection schemes
Flowchart
Run the application
In this example you will learn to:
1. Using the component in a protection scheme with multiple modules (Scheme D).
Protection schemes
This example uses the scheme D
Scheme D

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;
ok:boolean;
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;
if (keydata.Status = Registered) then begin
Button1.Enabled := (IsValueOn(keydata.Values,3,0));
Button2.Enabled := (IsValueOn(keydata.Values,3,1));
Button3.Enabled := (IsValueOn(keydata.Values,3,2));
end else begin
Button1.Enabled := False;
Button2.Enabled := False;
Button3.Enabled := False;
end;
end;
|
The scheme is similar to Example 3, the only change is that it has eliminated the OnPaint event handler so now the main form will be accessible forever, even in unregistered state.
Brief practice with example 4a
From the Delphi IDE open the example 4a (\Examples\4\a)

Run the application
Hit the button or click F9 to start the program. In moments you will see the registration form:

Note that the current registration status is "Not registered". This is because it is first executed the program and for "a" versions, the trial period is not started automatically.
We have two choices to start the trial period:
a) Offline way. Using the method MakeTrial () with the [Start Trial with MakeTrial ()] button.
b) Online way. Using the basic OLM with the [Start Trial with Basic OLM] button. The example is configured to access the site www.av-soft.com which you can use to do the practices.
If the status is not registered then when clicking the [Continue >>] button, the application will terminate, so the main form will be unaccessible.
If you click the [Continue >>] while the unregistered status, the application will not end as in example 3 but would continue and access the main form "Main Form", but only with the [Free Features] enabled. This is the only difference with Example 3.

Not shown here the rest of the steps, since these are the same as already explained in example 3.
|