Using the underlying QlmLicense object in VB6 or VBA

In VB6 or VBA, you typically use the LicenseValidator class generated by the Protect Your Application wizard.

In some cases, you may need to access the underlying QlmLicense object since the LicenseValidator class does not expose all the methods of the QlmLicense class.

You can access the underlying QlmLicense object by calling the LicenseObject() method of the LicenseValidator class.

Example:

Dim license As Object
Set license = lv.LicenseObject ()

Dim userData as String
Dim response as String
userData = license.GetUserData("", activationKey, response)

If you need to create an uninitialized QlmLicense object, you can call the GetQlmLicense() method of the LicenseValidator class.

Example:

Dim license As QlmLicense
Set license = lv.GetQlmLicense
license.DefineProduct (...)

Example on how to deactivate a license in VBA

Private Sub DeactivateLicense()
    Dim response As String
    
    Dim computerID As String
    ' Replace this line with the identifer you are using for license binding
    computerID = lv.fOSMachineName
    
    lv.LicenseObject.ReleaseLicense "", lv.ActivationKey, computerID, response
    Dim releaseLicenseInfo As Object
    Set releaseLicenseInfo = lv.GetLicenseInfo
            
    Dim message As String
    
    If lv.LicenseObject.ParseResults(response, releaseLicenseInfo, message) = True Then
        ' Success
        MsgBox message, vbOK
    Else
        ' Failed
        MsgBox message, vbCritical
    End If
End Sub

Last updated