Protect an Embarcadero C++ Builder app with QLM

This guide provides a step-by-step procedure to protect an Embarcadero C+ +Builder app. Note that the steps below assume you have a QLM License Server already setup.

1. Launch the QLM Management Console

2. Create a product from the β€œDefine Product” tab or use the Demo 1.0 product if you are evaluating QLM.

3. Go to the "Protect your application tab":

  • Page 1: Select the product to protect and the License Server

  • Page 2: Select "C++ Builder"

  • Page 3: Leave the default settings or customize the look & feel if needed. By default, QLM will bind the license to the Computer Name. You can select the binding of your choice by setting the QlmLicenseBinding property located in the section "6. Qlm License Properties".

  • Page 4: Select the folder where your project source code is located and click Save.

  • Page 5: Click Finish

4. Open your C++ Builder project in RAD Studio

5. Copy the following files to your project's folder:

  • C:\Program Files\Soraco\QuickLicenseMgr\Redistrib\.net 4.0\QlmLicenseLib.dll

  • C:\Program Files\Soraco\QuickLicenseMgr\Redistrib\.net 4.0\QlmLicenseWizard.exe

6. Add the following files to your project:

  • LicenseValidator.cpp/h

  • mscoree_TLB.cpp/h

  • mscorlib_TLB.cpp/h

  • QlmLicenseLib_TLB.cpp/h

7. The files QlmLicenseLib.dll, QlmLicenseWizard.exe and the XML settings file must be configured to be deployed to the same folder as your executable.

8. In your app's module where you want to add license validation, add the following code:

  • Add the following statement:

    • #include "LicenseValidator.h"

  • Declare the following variables

    • UnicodeString qlmWizard;

    • UnicodeString settingsFile;

    • UnicodeString wizardArgs;

    • TLicenseValidator* lv;

  • Declare the following function in the header file of your app's module:

    • int __fastcall DisplayLicenseForm();

9. Add the code similar to the code below where you want to perform the license validation. Modify the class name below (TAppForm) to match your own class.

void __fastcall TForm1::FormCreate(TObject *Sender)
    lv = new TLicenseValidator();
    bool needsActivation=false;
    UnicodeString errorMsg=L"";
    // Example of getting a unique identifier
    IQlmHardware *qlmHardware = lv->CreateQlmHardwareObject();
    UnicodeString computerID=qlmHardware->GetMachineName();
    ELicenseBinding licenseBinding=ELicenseBinding::ELicenseBinding_ComputerName;
    settingsFile = ExtractFilePath(Application->ExeName) + L"Demo 1.0.lw.xml";
    qlmWizard = ExtractFilePath(Application->ExeName) + L"QlmLicenseWizard.exe";
    wizardArgs = L" \/settings \"" + settingsFile + "\"";
    // If you use a LicenseBinding of type UserDefined, you must pass the computerID
    // wizardArgs := '/settings "' + settingsFile + '" /computerID ' + computerID;
    bool licenseValid=lv->ValidateLicenseAtStartup(licenseBinding, needsActivation, errorMsg);
    if (needsActivation || (licenseValid==false))
        if (lv->ValidateLicenseAtStartup(licenseBinding, needsActivation, errorMsg) == false)
int __fastcall TForm1::DisplayLicenseForm()
    CComBSTR pName(wcslen(qlmWizard.c_str()));
    wcscpy(pName.m_str, qlmWizard.c_str());
    CComBSTR pArgs(wcslen(wizardArgs.c_str()));
    wcscpy(pArgs.m_str, wizardArgs.c_str());
    return lv->QlmLicenseObject()->LaunchProcess(pName, pArgs, true, true);

This completes the integration. The next time you open your Delphi application the ValidateLicenseAtStartup method should get triggered and perform the license validation.

To generate a license key for testing purposes:

  • Go to the Manage Keys tab.

  • Click "Create Activation Key"

  • Select the Product (Demo 1.0 for trials) and click OK.

  • Copy and Paste the generated Activation Key in the License Wizard launched when your application starts up and follow the steps in the wizard.

The files that you need to distribute with your application are:

  • QlmLicenseLib.dll

  • QlmLicenseWizard.exe

  • XML file generated by the Protect Your Application Wizard

Last updated