The frmWarning as we already know, will appear only if the user is not registered. Here it is:
The Label5 will display the software code to the user make the register. This is done by adding this code to the OnShow event:
Label5.Caption:=frmMainForm.ActiveLock1.SoftwareCode;
We are referring to the ActiveLock1's SoftwareCode property that is in the frmMainForm. This is necessary because the user should knows this code to get registered. The "SoftwawreCode and the LiberationKey uses hexadecimal values. Therefore, the only valid digits are: 0123456789abcdef. If your user send you his SoftwareCode, he may type zero as "o" for orange. Just take it as zero. No "o" for orange is used in both SoftwareCode and LiberationKey. Anyway, to prevent confusion for the user, you may like to include a note on this in the Registration Form." (from the Inter Netion tutorial 'How to use ActiveLock 1.5').
Other interesting note from Nelson Ferraz:
"ActiveLock 1.5 uses the Windows' serial number and other system's properties to generate SoftwareCodes. If Windows is reinstalled, the SoftwareCode changes, and the user would have to register again.
I've provided more flexibility to the developer in ActiveLock 1.6 (beta software), allowing him/her to choose how the SoftwareCode is generated. 1.6 is very stable, but undocumented.
Note that the SoftwareCode isn't stored in the user's system - it's calculated on-the-fly, so it can't be easily changed. On the other hand, the LiberationKey and other properties are encrypted and stored in the registry."
Other important question in a Trialware is that the user can change the system's clock backward to try to gain an extra time. So, this code can be very useful to avoid this trick:
if (frmMainForm.ActiveLock1.LastRunDate) > Now then
The application will not run until the user return the clock to its original run date.
In this form, the system will display how many days left to cease the Trialware. A count down to remind the user how many days left until the application turns not available (the application will not stop to function, only the button that gives access to continue as Trialware will be disable, forcing the end user to enter the Liberation Key). Please, take a look:
SpeedButton2.Enabled:=False;
The Label 3 will display how many days left. I assigned a Integer variable called DaysLeft.
var
DaysLeft:Integer;
After this, is good assign a default value to the variable, just to initialize it.
DaysLeft:=0;
You can choose how many days your application will be a Trialware. In this case I choose 15 days. After all security verifications, now is time to show how many days the user has to use your application as Trialware, if there are days to spend.
I assigned to the variable DaysLeft the amount of time I want to be Trialware, 15 days. After this, you'll subtract the days used by the user. This, will give me how many days left. If this number is less than 0 (or you can use =< 0) a message you'll inform the user that the Trialware time has expired, else this value will be displayed in the Label 3. Now you'll convert this integer value into a string containing the decimal representation of that number and send to the Label 3.
DaysLeft:=15 - (frmMainForm.ActiveLock1.UsedDays) ;
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Label3.Caption:=IntToStr(DaysLeft);
Please, take a look at the entire code of this procedure how it is:
//In this procedure will run since this form is called, //avoiding the user to see the main form if the software is not registered. procedure TfrmWarning.FormShow(Sender: TObject); var //This variable receives the Days Left to the end of the evaluation time DaysLeft:Integer; begin //This is just to initialize the variable, you may //remove this declaration DaysLeft:=0; //The Software Code will be displayed in the Label5 Label5.Caption:=frmMainForm.ActiveLock1.SoftwareCode; //Verify if the user have changed the system clock backward if (frmMainForm.ActiveLock1.LastRunDate) > Now then //If yes, the application will show a message and will close begin Application.MessageBox('This trial program has detected the clock has been changed backwards and will now exit.', 'Clock backward detected!!!',MB_OK); Application.Terminate; end //If the system clock was not modified since the last run, //the variable DaysLeft will receive the number 15 //(because we choose to be 15 days only), //less the ActiveLock's UsedDays property. else DaysLeft:=15 - (frmMainForm.ActiveLock1.UsedDays) ; //If the Daysleft is less than zero, the Labels 2 and 4, and //the SpeedButton2, //will be disabled. The Label3 will show the text //YOUR EVALUATION TIME HAS EXPIRED!!! if DaysLeft < 0 then begin Label2.Visible:=False; Label4.Visible:=False; Label3.Caption:='Your evaluation time has expired!!!'; SpeedButton2.Enabled:=False; end else //If the Daysleft is greater than zero, the Label3 will display //the available days to the trial Label3.Caption:=IntToStr(DaysLeft); end;Now we can go to the Entering the Liberation Key .