ImageGear .NET - Updated
Using the LDK when the Target Machine Has Internet Access (Online Mode)
User Guide > Licensing and Distributing > Runtime Licensing > Node-Locked Licensing > Using the LDK when the Target Machine Has Internet Access (Online Mode)
  1. Build a new project that utilizes the LDK module to acquire the license key.

    You can use the LDK module in any project. But, we recommend building a separate project so that it will be easier to isolate the licensing from your normal application operation.

  2. Add the AccuLicClient.dll to your project references. AccuLicClient.dll is available in the following folders:
    • C:\Users\Public\Documents\Accusoft\ImageGear.NET v24\Licensing\Deployment\x64
    • C:\Users\Public\Documents\Accusoft\ImageGear.NET v24\Licensing\Deployment\x86
  3. You'll need to register AccuLicClient.dll on the target machine during runtime, for example, as part of your installation or licensing process.
    • In your code, run the following to COM-register AccuLicClient.dll on the target machine: 
      Copy Code
      %SYSTEMROOT%\System32\regsvr32.exe AccuLicClient.DLL
      Copy Code
      %SYSTEMROOT%\syswow64\regsvr32.exe AccuLicClient.DLL
  4. Add the license configuration file (and the access key file, if you’re assigning access keys) that you downloaded in step 1: Generate a License Configuration File.
  5. When using the LDK module, these are the main steps to be done in your code (see the code example below for details):
    1. Set the path to the license configuration file using the ConfigPath property.
    2. Call the LicKey property to see if a license is already on the target machine (to avoid unnecessary consumption of runtime licenses).
    3. If the machine is not already licensed, download a license using the GetLicKeyAuto method.
    4. Here, you can provide an access key. You must provide an access key if you are using Annual/time-based Licenses; if you’re not using Annual Licenses, access keys are optional so that you can track which machines are assigned licenses. Otherwise, the licensing component will assign an access key for you.
  6. Execute your project on the target machine.
    On successfully executing your code, a license is downloaded from the Accusoft server and placed into the registry.
  7. The LDK will return a Result code indicating the license status.
The code example below demonstrates how you can use the LDK module.
Copy Code
// Instantiate the LDK ActiveX component
IDeploymentComponent ldk = new DeploymentComponent();

// Set the path to the configuration file provided
// when the runtime licenses were purchased.
ldk.ConfigPath = @"C:\config.txt";

//Check to see if a license is currently on the machine
//If so, then there’s no need to proceed
If (ldk.LicKey != "")
     MessageBox.Show("A license already exists on this machine.");

// Attempt to get the next available license.
// Pass an Access Key as a parameter if you are using annual licensing or have opted to use Access Keys
if (ldk.ResultCode != enumLdkErrorCodes.LDK_SUCCESS)
    // Automatic Registration Failed - A temporary license
    // has been installed but will expire in 14 days.
    // You will need to add code to notify your user of this issue and the 14 day
    // expiration.

    if (ldk.ResultCode == enumLdkErrorCodes.LDK_ERR_INET_CONN_BROKEN)
        // You will need to handle what happens when your user does not have an internet connection on the target machine.
        // See the next section for information on manual (offline) registration
    // The license has been registered and installed.

Licensing Development Kit Interface

The interface to the LDK is shown below:

Copy Code
interface IDeploymentComponent : IDispatch
[propget, id(1)] HRESULT LicKey ( [out, retval] BSTR* pVal );
[propput, id(1)] HRESULT LicKey ( [in] BSTR newVal );
[propget, id(2)] HRESULT srvURL ( [out, retval] BSTR* pVal );
[propput, id(2)] HRESULT srvURL ( [in] BSTR newVal );
[propget, id(3)] HRESULT ConfigPath ( [out, retval] BSTR* pVal );
[propput, id(3)] HRESULT ConfigPath ( [in] BSTR newVal );
[propget, id(4)] HRESULT ResultString ( [out, retval] BSTR* pVal );
[propget, id(5)] HRESULT ResultCode ( [out, retval] enumLdkErrorCodes* pVal );
[id(6)] HRESULT GetLicKeyAuto ( [in] BSTR accKey );
[id(7)] HRESULT GetHdwKey ( [in] BSTR accKey
, [out,retval] BSTR* hdwKey );
[id(8)] HRESULT StartEvalPeriod ( void );
[id(10)] HRESULT GetEvalPeriod ( [out, retval] long* pVal );

LDK Properties

LDK Methods