Getting Started
Firstly, depending on the development environment you're using you might want to drop the control on to a form (see the demo video on the
Features page) or, as we'll demonstrate below, you can use late binding.
The following code is VBA but you can do the same in all languages. If you need help, please
contact us.
Before you write any code, add a reference to your application for the AppLicx86.ocx or AppLicx64.ocx depending on whether you're building a 64bit application or 32bit application. If you're not sure which you're building, we suggest using the x86 version.
First, define the object at the top of the form.
Public AppLicSecurity As Object
Alternatively, to get the intellisense prompts you can define the object like this
Public AppLicSecurity As ApplicLib.Licensing
Next, within a startup function (for instance the Form_Load function of the startup form) create the object.
Set AppLicSecurity = CreateObject('ApplicLib.Licensing')
The
ApplicationCode property defines the software being used and therefore needs to be unique amongst everyone using AppLic security. When you create the object, a random 10 character code is created - as the help section for ApplicationCode reminds you, this needs to match the Application Code defined on the website on the Admin page. So you can either create yourself a new ApplicationCode or set a breakpoint and use the Immediate window or Watch expression to find out the randomly generated code.
Just by creating the object, several defaults have been set. The help pages for each property tell you what the default is. For example, the demo period is 0 days. To set a demo period you can do one of the following:
'Set demo to 30 days
AppLicSecurity.DemoLength = 30
Or
'Set demo to 20 tries
AppLicSecurity.DemoType = 1
AppLicSecurity.DemoLength = 20
The final piece of code you need to put in is to check to see if the license is valid.
Dim iReturnVal As Integer
iReturnVal = SecurityCtrl.ActivateSecurity
if iReturnVal = 0 Then
DoCmd.Quit
Else If iReturnVal = 2 Then
g_bIsDemoMode=True
'A global value used to limit functionality
Else
'Continue, the application is licensed
End If
The only other thing you need to do now is to set up a license key on the website and test out your new licensing software!