To support licensing, your ActiveX designer needs to implement the IClassFactory2 interface, which derives from IClassFactory. The interface includes three methods for licensing:
The interface is defined in the header file Olectl.h It uses the LICINFO structure, which includes the following fields:
Field | Type | Description |
cbLicInfo | long | Size of LICINFO structure. |
FRuntimeKeyAvail | BOOL | True if the class provides a run-time key. |
FLicVerified | BOOL | True if the license has been verified. |
The structure provides information about the licensing key. The first member, cbLicInfo, gives the size of the structure. The fRuntimeKeyAvail member is a Boolean that is True if the class provides a run-time key that can be built into an application.
The Boolean fLicVerified flag is set to True when the ActiveX designer has verified that it is licensed for this machine. If the designer can determine that a valid license is present before it receives a key, it sets this flag. If the current user or machine license is supposed to override the application license corresponding to a key, the designer can use fLicVerified to avoid passing the key unnecessarily.
To provide maximum flexibility, license keys are defined as BSTR, which can be any length and can include Null characters.