Skip to content

License Return Codes

This page documents every return code, error code, and enumeration value used by the VBA Padlock licensing system. Use this as a reference when handling results from the VBA Bridge API or DLL exports.

These codes are returned when decoding or validating a license key.

CodeConstantDescription
0LICENSE_OKLicense is valid
-1LICENSE_ERR_INVALID_CHECKSUMThe license key checksum does not match (corrupted or truncated key)
-2LICENSE_ERR_INVALID_FORMATThe license key format is not recognized
-3LICENSE_ERR_INVALID_VERSIONThe license key was generated with an unsupported format version
-4LICENSE_ERR_INVALID_SIGNATUREThe cryptographic signature is invalid (the key was not generated with the correct private key)
-5LICENSE_ERR_DECOMPRESSIONInternal decompression of the license payload failed
-6LICENSE_ERR_EXPIREDThe license has expired (past the expiration date)
-7LICENSE_ERR_MAX_RUNSThe maximum number of executions has been reached
-8LICENSE_ERR_HARDWARE_MISMATCHThe license is bound to a different Hardware ID
-9LICENSE_ERR_WRONG_APPThe license was generated for a different VBA Padlock project
-10LICENSE_ERR_DECODE_FAILEDGeneral decoding failure (invalid license string)
-11LICENSE_ERR_EMPTY_KEYNo license key was provided (empty string)

Returned by VBAPL_ShowActivation / VBAPLShowActivation.

CodeMeaningSuggested Action
1Activation successfulProceed normally
0Cancelled or failedPrompt user to try again or exit
-1Not initialized (DLL error)Check DLL file paths
-2Activation not configuredNo action needed (project does not require activation)

Returned by VBAPL_ShowDeactivation / VBAPLDeactivateGUI.

CodeMeaningSuggested Action
0License deactivated successfullyInform user they can activate on a new computer
1Cancelled by userNo action needed
-1Not initializedCheck DLL initialization
-2No license to deactivateUser has not activated yet
-3Already deactivatedLicense was already removed
-4Deactivation not allowedThis project does not permit deactivation
-5Internal errorContact support

The same codes apply to VBAPL_Deactivate / VBAPLDeactivate (programmatic deactivation), except there is no 1 (cancelled) since no dialog is shown.

Returned by VBAPL_GetDeactivationStatus / VBAPLGetDeactivationInfo.

CodeMeaning
0Deactivation is allowed (license is active)
1Deactivation is allowed (but no license is stored)
2Deactivation is not allowed for this application
3License already deactivated or blacklisted
-1Not initialized

Returned by VBAPL_ShowTrialNag / VBAPLShowTrialNag.

CodeMeaningSuggested Action
0User chose to continue trialProceed normally (limited functionality)
1User wants to activateCall VBAPL_ShowActivation
2User clicked purchase linkURL opened in browser; user continues in trial
-1Error or not initializedCheck DLL initialization
-2Not in trial modeNo action needed
-3Silent mode enabledNag screen is disabled in project settings

Returned by VBAPL_ShowEULA / VBAPLShowEULA.

CodeMeaningSuggested Action
1EULA acceptedProceed normally
0EULA declinedClose the application
-1ErrorCheck DLL initialization
-2EULA not configuredNo action needed (project has no EULA)

Returned by VBAPL_VerifyDLLSignature / VBAPLVerifyDLLSignature.

CodeMeaningSuggested Action
0Valid signature (G.D.G. Software)DLL is authentic
1DLL is not signedDLL may have been tampered with
2Invalid or corrupted signatureDLL has been modified
3Signed by wrong publisherDLL is not from G.D.G. Software
4Signing certificate expiredContact vendor for updated DLLs
5System error during verificationWindows API error
-1Not initializedCall after DLL initialization

Returned by VBAPL_ValidateOnline / VBAPLValidateOnline.

CodeMeaningSuggested Action
1Validation successfulLicense is valid on the server
0Failed or license revokedDisable the application
-1Not initializedCheck DLL initialization
-2Online validation not configuredNo action needed
-3No license storedUser must activate first
-4Network errorRetry later; optionally allow offline grace period
-5Server errorServer-side issue; retry later
-6Security validation failedServer response could not be verified

Returned by VBAPLIsValidationRequired:

CodeMeaning
1Validation is required now
0Not required yet (within the configured interval)
-1Not initialized
-2Online validation not configured

Used in the license key payload. Visible through GetLicenseProperty or decoded from the key.

CodeTypeDescription
0FullPermanent license with no restrictions
1TrialTime-limited or run-limited trial
2SubscriptionRecurring license requiring periodic validation
3Time-LimitedLicense that expires on a specific date
CodeEditionDescription
0StandardStandard edition
1ProfessionalProfessional edition
2EnterpriseEnterprise edition
3CustomCustom edition (uses the CustomEditionName field)

Your compiled scripts can check the edition to enable or disable features:

Dim edition As String
edition = GetLicenseProperty("edition", "Standard")
Select Case edition
Case "Professional", "Enterprise"
' Enable advanced features
EnableAdvancedMode
Case Else
' Standard features only
End Select
CodeConstantDescription
0tltDaysTrial measured in days since first launch
1tltRunsTrial measured in number of executions
2tltExpirationTrial expires on a fixed date

Here is a pattern for comprehensive error handling using the return codes:

Public Sub StartApplication()
' 1. Show EULA
Dim eulaResult As Long
eulaResult = VBAPL_ShowEULA()
Select Case eulaResult
Case 0
MsgBox "You must accept the license agreement.", vbCritical
ThisWorkbook.Close False
Exit Sub
Case -1
MsgBox "Initialization error.", vbCritical
Exit Sub
Case -2, 1
' EULA accepted or not configured — continue
End Select
' 2. Check license
If Not VBAPL_IsLicenseValid() Then
If VBAPL_IsTrialMode() Then
Dim trialLeft As Long
trialLeft = VBAPL_GetTrialLimitLeft()
If trialLeft = 0 Then
MsgBox "Your trial has expired.", vbExclamation
VBAPL_ShowActivation
Else
VBAPL_ShowTrialNag
End If
Else
Dim activResult As Long
activResult = VBAPL_ShowActivation()
If activResult <> 1 Then
MsgBox "Activation is required to use this application.", vbCritical
ThisWorkbook.Close False
Exit Sub
End If
End If
End If
' 3. Online validation (if configured)
If VBAPL_IsLicenseValid() Then
Dim valResult As Long
valResult = VBAPL_Execute("Main|CheckOnlineValidation")
End If
' 4. Run main application
VBAPL_Execute "Main|Initialize"
End Sub