If the fRuntimeKeyAvail field in LICINFO has been returned as TRUE from IClassFactory2::GetLicInfo, then this method creates and returns a license key. The caller can save the license key persistently and use it later in calls to IClassFactory2::CreateInstanceLic.
HRESULT RequestLicKey(
DWORD dwReserved, //Unused. Must be zero.
BSTR* pbstrKey //Pointer to the license key
);
This method supports the standard return values E_INVALIDARG, E_OUTOFMEMORY, and E_UNEXPECTED, as well as the following:
The caller can save the license key for subsequent calls to IClassFactory2::CreateInstanceLic to create objects on an otherwise unlicensed machine.
The caller must free the BSTR with SysFreeString when the key is no longer needed. The value of fRuntimeKeyAvail is returned through a previous call to IClassFactory2::GetLicInfo.
This method allocates the BSTR key with SysAllocString
or SysAllocString[Len]
, and the caller becomes responsible for this BSTR once this method returns successfully.
This method need not be implemented when a class factory does not support run-time license keys.
Windows NT: Use version 4.0 or later.
Windows: Use Windows 95 or later.
Windows CE: Unsupported.
Header: Declared in ocidl.h.
IClassFactory2::CreateInstanceLic, IClassFactory2::GetLicInfo, LICINFO