Using TurboActivate with Xojo (Real Studio / Real Basic)
Before you can do anything you need to login to your LimeLM account (or sign up). Then download TurboActivate for Windows, Mac OS X, or Linux:
- Download TurboActivate for Windows: contains TurboActivate.dll, TurboActivate.exe, & source code examples.
- Download TurboActivate for Mac OS X: contains libTurboActivate.dylib & source code examples.
- Download TurboActivate for Linux: contains libTurboActivate.so & source code examples.
After you've created a new product, go to the version page of the product you will be adding licensing to. You will need to do 2 things:
- Download the TurboActivate.dat file for the product version.
- Make a note of the Version GUID.
You'll be including the TurboActivate.dat file in the same folder as the TurboActivate.dll file and you'll use the Version GUID in your code as part of integrating TurboActivate within your app.
Included in TurboActivate API packs (get them on the API page) is a simple Xojo (Real Basic) example project. We've also included all the files you need to add to your Xojo project within the "Import to your project" folder. Just drag all of the files in that folder into your Xojo "Project" tab (or add the files one-by-one using the "File -> Import..." menu). The TurboActivate module contains all the functions you'll be using to add licensing, online-activation, and trial functionality to your app.
TurboActivate on Windows
On Windows you'll be using the x86 version of TurboActivate. Copy the TurboActivate.dll to the same folder as the example project (and your project). And while you're at it put the TurboActivate.dat file that you downloaded earlier in this same folder. Now you can use TurboActivate while debugging your app. If you're not outputing your final exe to the same folder as your Xojo project then make sure to include the TurboActivate.dll and TurboActivate.dat files in the same folder as your outputted *.exe file.
TurboActivate on Mac OS X
Mac OS X is a bit different than Windows. On Windows, when you build your app, you have a single exe and all you have to do is include the TurboActivate.dat and TurboActivate.dll files in the same folder as that exe. On Mac OS X, however, when you build your app a "bundle" is created. If you're not familiar with Mac OS X an "app bundle" is like an exe (you double click it and your app runs), however behind the scenes the "bundle" is just a folder with the actual app and resources in sub-folders.
For instance, when you use our example Xojo project and build on Mac a "TestApp" bundle will be output:
This is really a folder called "TestApp.app". When you're releasing your app for customers you'll want the TurboActivate.dat and libTurboActivate.dylib files to be inside the app bundle. You can do this manually by right clicking the app bundle (in the example, TestApp) then clicking "Show Package Contents":
Add the TurboActivate.dat file to the
TestApp.app/Contents/MacOS/ folder and add the libTurboActivate.dylib file to the
If you actually want to use TurboActivate while you're debugging your app then you need to make a temporary change to the "TALibrary" constant in the TurboActivate module:
For instance, to use the libTurboActivate.dylib in the same folder as your app's bundle, then change the "Mac OS" value to the following:
You'll also need to call PDetsFromPath() to load the TurboActivate.dat. For example, put this before you make any TurboActivate function calls:
#If DebugBuild PDetsFromPath("/location/to/TurboActivate.dat") #Endif
A good place to put these lines of code is before your call to IsGenuine() or IsActivated().
You must set the
VersionGUID constant in the TurboActivate module before you use any TurboActivate functions. Just paste the Version GUID that you copied earlier into the "Default Value" text box:
IsActivated(), IsGenuine(), IsGenuineEx()
There are 3 separate TurboActivate functions for checking whether a customer is activated or not:
IsActivated()checks if the user is activated without contacting any servers (no internet connection needed ever). It does this by verifying the cryptographically signed "computer fingerprint".
IsGenuine()contacts the LimeLM servers to see if the user is still activated (checks for revoked product keys, etc.) and whether features have changed. This function requires an active internet connection to succeed (or else you get
IsGenuineEx()is a mix of the best parts of
IsGenuineEx()you can specify how often to check with the LimeLM servers and all other times it verifies the activation locally. (Note: in Xojo
IsGenuineEx()is the overloaded
IsGenuine()function with 3 or 4 parameters.)
For most cases we recommend using
IsGenuineEx(). For example:
Dim isActivated As Boolean Dim gr As IsGenuineResult Try ' Check if we're activated, and every 90 days verify it with the ' activation servers. In this example we won't show an error if ' the activation was done offline. (see the 3rd parameter of ' the IsGenuine() function) gr = TurboActivate.IsGenuine(90, 14, True) isActivated = (gr = IsGenuineResult.Genuine Or _ gr = IsGenuineResult.GenuineFeaturesChanged Or _ gr = IsGenuineResult.InternetError) Catch err As RuntimeException MsgBox "Failed to check if activated: " + err.Message End Try If isActivated Then ' your app is activated and genuine If gr = IsGenuineResult.InternetError Then 'TODO: give the user the option to retry the genuine ' checking immediately. For example a dialog box. ' In the dialog call IsGenuine() to retry immediately. End If Else ' TODO: Not genuine or not activated. Either way you should either ' restrict the user from using your app or give the user a trial ' of your app. End If
UseTrial() function starts and/or revalidates the trial. The
TrialDaysRemaining() function returns the number of days remaining in the trial. When
TrialDaysRemaining() returns 0 you should disable your apps features and require them to activate. See the example project.
Note: Always call
UseTrial() before calling
' ... If isActivated Then ' your app is activated and genuine, see above Else ' not genuine / not activated TurboActivate.UseTrial() If (TurboActivate.TrialDaysRemaining = 0) Then 'TODO: disable the features of your app Else ' trial days remaining End If End If
Learn more about using trials & trial extensions to win over prospective customers.
We recommend you use the TurboActivate.exe for entering product keys and activating your product. In the example project we show how to launch TurboActivate.exe and then check if the user is activated after it closes.
If you want to build your own interface then just use the
CheckAndSavePKey(string pkey) and