English

Error: License not available on AddExtension method

Error Message

When you invoke method calls on ESRI extension products from a stand-alone application, the methods fail with "license not available", even when you have a valid extension license.

Cause

Within VBA, you can supply a "0" as an argument to AddExtension:
pExtAdmin.AddExtension pUid, 0
From a stand-alone application, however, 0 is an invalid value.

Solution or Workaround

Substitute a variant for the "0" that is passed as the second parameter to the AddExtension method.

Code:
Dim pUid As UID
Set pUid = New UID
pUid.Value = "esriCore.SAExtension"

Dim pExtAdmin As IExtensionManagerAdmin
Set pExtAdmin = New ExtensionManager

Dim var As Variant
pExtAdmin.AddExtension pUid, var