IClassFactory2::RequestLicKey (Compact 2013)
3/26/2014
If the fRuntimeKeyAvail member 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.
Syntax
HRESULT RequestLicKey(
DWORD dwReserved,
BSTR* pbstrKey
);
Parameters
- dwReserved
[in] Unused. Must be zero.
pbstrKey
[out] Pointer to the caller-allocated BSTR variable that receives the callee-allocated license key on successful return from this method.This parameter is set to NULL on any failure.
Return Value
This method supports the standard return values E_INVALIDARG, E_OUTOFMEMORY, and E_UNEXPECTED, as well as the following:
- S_OK
The license key was created.
- E_NOTIMPL
This class factory does not support run-time license keys.
- E_POINTER
The address in pbstrKey is not valid. For example, it can be NULL.
- CLASS_E_NOTLICENSED
This class factory supports run-time licensing, but the current machine is not licensed. Thus, a run-time key is not available on this machine.
Remarks
The caller can save the license key for subsequent calls to IClassFactory2::CreateInstanceLic to create objects on an otherwise unlicensed machine.
To determine whether the platform supports this interface, see Determining Supported COM APIs.
Notes to Callers
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.
Notes to Implementers
This method allocates the BSTR key with SysAllocString or SysAllocString[Len], and the caller becomes responsible for this BSTR when this method returns successfully.
This method need not be implemented when a class factory does not support run-time license keys.
Requirements
Header |
ocidl.h, |
Library |
ole32.lib, |
See Also
Reference
IClassFactory2
IClassFactory2::CreateInstanceLic
IClassFactory2::GetLicInfo