
|
The most ease way to understand how to use the AVLockGold component and the AVLockManager utility is making a sample. Follow step by step this basic sample:
|
1. Open a new project
2. Drop an AVLockGold component into the main form.
For VCL Delphi

For .NET platform VS2003 / Delphi 2005

3. Insert a line of code
For VCL Delphi:
//into the OnCreate event
procedure TForm1.FormCreate(Sender: TObject);
begin
AvLockG51.execute;
end;
For .NET platform VS2003 / Delphi 2005
//Sample in C# language
//into the Load event
private void Form1_Load(object sender, System.EventArgs e)
{
avLockGold1.execute();
}
4. Compile the project.
A project1.exe file will be generated. into your app folder, or into app\bin\Debug folder for the .NET. version.
5. If at this point you have already finished your app and nothing else will be added, then you would to close your Delphi or VS2003 IDE and accomplish all another needed tasks into the AVLockManager utility.
6. Open the AVLockManager utility (run the avmanager.exe file).

7. Click the [Add] button in order to add a new application to your application list. The "add application" form will be displayed.

8. Fill the "Application Name" field to assign a name to your app (e.g. MyProgram).
9. Fill the "Application Path" field with the appropriate value (e.g. c:\avlockg5\myprogram).
10. Fill the "Executable file" with the appropriate value (e.g. project1.exe).
11. For this sample leave blank the optional "Encryption Key" field.
NOTE: The "Encryption Key" field is case sensitive. Blank for all demos in v5.3. In previous versions
Demo1= blank, Demo2 = "myencryptionkey123", Demo3 = "Demo3" and Demo4 = "Demo4".
12. Click the [Ok] button in order to save the new application.
NOTE: At this point a new record (section) will be added to the applications.ini file (e.g. c:\avlocg5\avman\applications.ini) and the avconfig.ini file will be created into the application directory (e.g. c:\avlockg5\myprogram\avconfig.ini) in order to save all configuration data into the "Settings" and "Modules" tabsheets.

Settings tabsheet
Modules tabsheet
13. Take a look to the "Settings" and "Modules" tabsheets. See as the "AppID" value has been copied into the "Moule-ID" column for the first row (module 0) correspondig to the main application. See too the "Trial mode" group box where is configured the trial behavior, in this case the mode is "Relative" (the trial start when the user run the program the first time) and while a period of 30 days. See too the checkbox with the text "The program expires when the user turn back the system date", this must be checked.
NOTE: The "AppID" value is randomly generated when you add a new application, however you may to modify it and enter any value that you want but this must be different in each application.
14. Click the [Run] button. Your app will run the first time and the trial started accordantly with your trial configuration.You will be prompted to enter your user name and company, then the registration form will come up showing the message "Days left to expire: 30" and below the progress bar starting in the current system date and finishing 30 days later.

15. Press the [Continue>>] button from the registration form, then the main form of your app will be exposed.
16. Close your application.
17. Advance the system date one day, then press the run button again.
18. Take a look to the registration form. Now the message will say "Days left to expire: 29".
19. Close your application.
20. Turn back the system date one day coming back to the previous value, then press the run button again.
21. Now the registration form will come up with the [Continue>>] button disabled. You will not be able to enter into the main form of your application unless that you advance the system date to the higher value that your app reached sometime, in this case one day later. The security mechanism is working!!
22. Click the [Unregister] button. This will erase all registration data allowing you to try again with another configuration.
NOTE: It's not possible that anybody utilize this way to unregister the application and restart as trial an expired application, since he doesn´t know the "encryptionkey" string and the "AppID" number. This number (AppID) is unique for each application and allow to an user to have installed several applications managed with AVLockGold in the same machine.
23. Change some configuration data in the "Trial mode" group box into the "Settings" and try to run again and see what happen.
24. Repeat the points 23 and 24 until you understand how this work.
25. Unregister the app and restore your settings to the original status (30 days Relative trial, "InstallCode based" lock strategy).
26. Click the Run button. When the registration form bring up then select the InstallCode value and copy it into the clipboard (Ctrl-C) or copy it in anyplace you want. This will be used in the step 31.
27. Open the "Users & Keys" tabsheet.

28. Click the [Add] button into the "Users" groupbox in order to add a new user to your users list. The "add user" form will be displayed.

29. Fill the fields "User name", "Company" and "Email address" with your own data or any other.
30. Fill the "InstallCode" field with the value stored in the clipboard (Ctrl-V) or enter it manually.
31. Fill the "Max users" field with the value that you want to use. This value only make sense when the app is running in a network.
32. Click the [Ok] button in order to save the new user.
33. Take a look to the Modules grid. Here only found the first row corresponding to the module 0, that is the main module, namely the application.

34. In the column "Key Type" you can select the type of key between (Permanent, Temporary or Unregister), Select Temporary.
35. Enter 90 in the "Days" column and the current date in the "Start Date" column, then check the checkbox in the "Gen" column. Now you will see the generated key into the "Generated key" column.
36. Click the [Copy current key] button to copy the generated key into the clipboard.
37. Go to the opened Registration Form in the step 27 or reopen it clicking on the Run button.
38. Enter the key into the registration form manually or with Ctrl-V to paste from the clipboard.
39. Click the Register button. Enter the user name and company if you are prompted, then you will see a message box with the legend "1 Keys Registered".
40. Now the application had passed from the Trial status to the Authorized Status. Now you can see the main form of your application.
NOTE: The application can be in the following four status: Trial, Authorized, Registered and Expired.
Trial is the first period previous to the registration process. Authorized is for temporary registration used when you want extend the trial period or rent your soft. Registered is the status when the application is permanently registered, used when you sell your soft. Expired is the status where the program come down when a trial period or a authorized period reaches the end, or when by security reasons the program is forced to this status.
41. Close your application and click the [Run] button again.
42. What changed? Now the Registration Form is baypassed and the main form is reached directly. That is good for registered users but in some cases the user can need to acces to the registration form e.g. to register a new period. How to solve this problem? See the next step.
43. Close your app and go to your IDE and drop a button control upon the main form and enter the "Registration" text into his caption.

44. Enter the following code:
For VCL Delphi:
//into the OnClick event:
procedure TForm1.Button1Click(Sender: TObject);
begin
AVLockG51.doexecute;
end;
For .NET platform VS2003 / Delphi 2005
//Sample in C# language
private void button1_Click(object sender, System.EventArgs e)
{
avLockGold1.doexecute();
}
45. Compile and try again with the [Run] button. Now you will to have access to the registration form through this new button.
46. The Demo1 program included in the package is very similar to the one created in this sample, you may find it, for Delphi versions, into c:\AV_Soft\avlockg5\samples\demo1, and for .NET version into c:\AV_Soft\avlockg5\samples\c#\demo1. Open it into the IDE and compile. Create a new application into the AVLockManager utility with the "Demo1" name and link it to the Demo1 location.
If you have any questions not answered by this help file, please don't hesitate to contact me at http://valega.com/contacto.php.
|