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.
License Error Codes
Section titled “License Error Codes”These codes are returned when decoding or validating a license key.
| Code | Constant | Description |
|---|---|---|
0 | LICENSE_OK | License is valid |
-1 | LICENSE_ERR_INVALID_CHECKSUM | The license key checksum does not match (corrupted or truncated key) |
-2 | LICENSE_ERR_INVALID_FORMAT | The license key format is not recognized |
-3 | LICENSE_ERR_INVALID_VERSION | The license key was generated with an unsupported format version |
-4 | LICENSE_ERR_INVALID_SIGNATURE | The cryptographic signature is invalid (the key was not generated with the correct private key) |
-5 | LICENSE_ERR_DECOMPRESSION | Internal decompression of the license payload failed |
-6 | LICENSE_ERR_EXPIRED | The license has expired (past the expiration date) |
-7 | LICENSE_ERR_MAX_RUNS | The maximum number of executions has been reached |
-8 | LICENSE_ERR_HARDWARE_MISMATCH | The license is bound to a different Hardware ID |
-9 | LICENSE_ERR_WRONG_APP | The license was generated for a different VBA Padlock project |
-10 | LICENSE_ERR_DECODE_FAILED | General decoding failure (invalid license string) |
-11 | LICENSE_ERR_EMPTY_KEY | No license key was provided (empty string) |
Activation Return Codes
Section titled “Activation Return Codes”Returned by VBAPL_ShowActivation / VBAPLShowActivation.
| Code | Meaning | Suggested Action |
|---|---|---|
1 | Activation successful | Proceed normally |
0 | Cancelled or failed | Prompt user to try again or exit |
-1 | Not initialized (DLL error) | Check DLL file paths |
-2 | Activation not configured | No action needed (project does not require activation) |
Deactivation Return Codes
Section titled “Deactivation Return Codes”Returned by VBAPL_ShowDeactivation / VBAPLDeactivateGUI.
| Code | Meaning | Suggested Action |
|---|---|---|
0 | License deactivated successfully | Inform user they can activate on a new computer |
1 | Cancelled by user | No action needed |
-1 | Not initialized | Check DLL initialization |
-2 | No license to deactivate | User has not activated yet |
-3 | Already deactivated | License was already removed |
-4 | Deactivation not allowed | This project does not permit deactivation |
-5 | Internal error | Contact support |
The same codes apply to VBAPL_Deactivate / VBAPLDeactivate (programmatic deactivation), except there is no 1 (cancelled) since no dialog is shown.
Deactivation Status Codes
Section titled “Deactivation Status Codes”Returned by VBAPL_GetDeactivationStatus / VBAPLGetDeactivationInfo.
| Code | Meaning |
|---|---|
0 | Deactivation is allowed (license is active) |
1 | Deactivation is allowed (but no license is stored) |
2 | Deactivation is not allowed for this application |
3 | License already deactivated or blacklisted |
-1 | Not initialized |
Trial Nag Return Codes
Section titled “Trial Nag Return Codes”Returned by VBAPL_ShowTrialNag / VBAPLShowTrialNag.
| Code | Meaning | Suggested Action |
|---|---|---|
0 | User chose to continue trial | Proceed normally (limited functionality) |
1 | User wants to activate | Call VBAPL_ShowActivation |
2 | User clicked purchase link | URL opened in browser; user continues in trial |
-1 | Error or not initialized | Check DLL initialization |
-2 | Not in trial mode | No action needed |
-3 | Silent mode enabled | Nag screen is disabled in project settings |
EULA Return Codes
Section titled “EULA Return Codes”Returned by VBAPL_ShowEULA / VBAPLShowEULA.
| Code | Meaning | Suggested Action |
|---|---|---|
1 | EULA accepted | Proceed normally |
0 | EULA declined | Close the application |
-1 | Error | Check DLL initialization |
-2 | EULA not configured | No action needed (project has no EULA) |
DLL Signature Verification Codes
Section titled “DLL Signature Verification Codes”Returned by VBAPL_VerifyDLLSignature / VBAPLVerifyDLLSignature.
| Code | Meaning | Suggested Action |
|---|---|---|
0 | Valid signature (G.D.G. Software) | DLL is authentic |
1 | DLL is not signed | DLL may have been tampered with |
2 | Invalid or corrupted signature | DLL has been modified |
3 | Signed by wrong publisher | DLL is not from G.D.G. Software |
4 | Signing certificate expired | Contact vendor for updated DLLs |
5 | System error during verification | Windows API error |
-1 | Not initialized | Call after DLL initialization |
Online Validation Return Codes
Section titled “Online Validation Return Codes”Returned by VBAPL_ValidateOnline / VBAPLValidateOnline.
| Code | Meaning | Suggested Action |
|---|---|---|
1 | Validation successful | License is valid on the server |
0 | Failed or license revoked | Disable the application |
-1 | Not initialized | Check DLL initialization |
-2 | Online validation not configured | No action needed |
-3 | No license stored | User must activate first |
-4 | Network error | Retry later; optionally allow offline grace period |
-5 | Server error | Server-side issue; retry later |
-6 | Security validation failed | Server response could not be verified |
Returned by VBAPLIsValidationRequired:
| Code | Meaning |
|---|---|
1 | Validation is required now |
0 | Not required yet (within the configured interval) |
-1 | Not initialized |
-2 | Online validation not configured |
License Types
Section titled “License Types”Used in the license key payload. Visible through GetLicenseProperty or decoded from the key.
| Code | Type | Description |
|---|---|---|
0 | Full | Permanent license with no restrictions |
1 | Trial | Time-limited or run-limited trial |
2 | Subscription | Recurring license requiring periodic validation |
3 | Time-Limited | License that expires on a specific date |
Edition Codes
Section titled “Edition Codes”| Code | Edition | Description |
|---|---|---|
0 | Standard | Standard edition |
1 | Professional | Professional edition |
2 | Enterprise | Enterprise edition |
3 | Custom | Custom edition (uses the CustomEditionName field) |
Your compiled scripts can check the edition to enable or disable features:
Dim edition As Stringedition = GetLicenseProperty("edition", "Standard")
Select Case edition Case "Professional", "Enterprise" ' Enable advanced features EnableAdvancedMode Case Else ' Standard features onlyEnd SelectTrial Limit Types
Section titled “Trial Limit Types”| Code | Constant | Description |
|---|---|---|
0 | tltDays | Trial measured in days since first launch |
1 | tltRuns | Trial measured in number of executions |
2 | tltExpiration | Trial expires on a fixed date |
Handling Errors in VBA
Section titled “Handling Errors in VBA”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 SubSee Also
Section titled “See Also”- VBA Bridge API Reference — All 20 VBAPL_* functions
- DLL Export Reference — Raw DLL function signatures
- Script Functions Reference — Functions available inside compiled scripts
- Troubleshooting — Common issues and solutions