bright, fresh software
Downloads  |  Buy

Using TurboActivate with C, C++, and Objective-C

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:

Adding licensing & online activation to your appTurboActivate.dat and Version GUID

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:

  1. Download the TurboActivate.dat file for the product version.
  2. Make a note of the Version GUID.

You'll be including the TurboActivate.dat file in the same folder as the TurboActivate (.dll, .dylib, or .so) files and you'll use the Version GUID in your code as part of integrating TurboActivate within your app.

Using TurboActivate

In addition to the TurboActivate library and .dat file, there are 2 other files that you'll need to include with your app to use the TurboActivate API in C, C++, or Objective-C: TurboActivate.h and, if you're targeting Windows, the "TurboActivate.lib" file.

#include "TurboActivate.h"
#ifdef _WIN32
    #pragma comment (lib, "TurboActivate.lib")
#endif

If you're making a Mac OS X or Linux app, you should also check out these articles:

IsActivated()

The IsActivated() function simply checks if the user is activated and returns TA_OK if the user is activated. You need to pass the version GUID you copied from earlier:

HRESULT hr = IsActivated(ProductVersionGUID);

if (hr != TA_OK)
{
    // the user is not activated
}

UseTrial(), TrialDaysRemaining()

The 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 TrialDaysRemaining().

if (IsActivated(ProductVersionGUID) != TA_OK)
{
    // check if grace period has expired
    unsigned int daysRemain = 0;

    UseTrial(TA_USER);

    HRESULT hr = TrialDaysRemaining(ProductVersionGUID, &daysRemain);
    if (hr == TA_OK && daysRemain > 0)
    {
        // trial days remaining
    }
    else
    {
        // trial has expired, disable the features of your app
        // tell the user they must activate
    }
}
else
{
    // the user is activated
}

Learn more about using trials & trial extensions to win over prospective customers.

TurboActivate wizardActivating your product

We recommend you use the TurboActivate.exe for entering product keys and activating your product. Simply 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 Activate() functions.

IsGenuine()

The IsGenuine() function connects to the LimeLM servers and reconfirms that your user's activation is valid. Using this function lets you retroactively revoke product keys. You do not need to (and should not) call IsGenuine() every time your application runs.

We recommend you call this function about every 90 days.

Also, if IsGenuine() returns TA_E_INET it might be a result of the user blocking TurboActivate from checking with the servers. We recommend you handle this case by first warning the user that the genuine check failed, then disabling the features of your app after X failures.


Static TurboActivate library

In addition to the dynamic version (*.dll / *.so / *.dylib) we also provide static versions of TurboActivate (*.lib / *.a). To use the static library you have to define "TURBOACTIVATE_STATIC" in your project, your makefile, or in your source before you include the "TurboActivate.h" header file.

Windows

We've built the TurboActivate static library for all variations of the C/C++ runtime library for both x86 and x64 platforms. When you're including the static library in your build you must ensure you're using the correct one or else you'll get a linker error like this:

error LNK2005: [function] already defined in MSVCRT.lib(MSVCR100.dll)

To find out what runtime library you're using, click the "Project -> [YourApp] Properties..." menu. In the dialog that pops up go to the "Configuration Properties" -> "C/C++" -> "Code Generation" node and look at the "Runtime Library" property:

Runtime Library

Use the TurboActivate static library that matches your runtime (in either the x86 or x64 folders):

TurboActivate-MT.lib   for Multi-threaded (/MT)
TurboActivate-MTd.lib  for Multi-threaded Debug (/MTd)
TurboActivate-MD.lib   for Multi-threaded DLL (/MD)
TurboActivate-MDd.lib  for Multi-threaded Debug DLL (/MDd)

If you're using the Multi-threaded runtime (/MT) the code would look like this:

#define TURBOACTIVATE_STATIC
#include "TurboActivate.h"
#pragma comment(lib, "TurboActivate-MT.lib")