IClassFactory2::RequestLicKey method (ocidl.h)

Creates a license key that the caller can save and use later to create an instance of the licensed object.

Syntax

HRESULT RequestLicKey(
  [in]  DWORD dwReserved,
  [out] BSTR  *pBstrKey
);

Parameters

[in] dwReserved

This parameter is reserved and must be zero.

[out] pBstrKey

A pointer to the caller-allocated 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 can return the standard return values E_INVALIDARG, E_OUTOFMEMORY, and E_UNEXPECTED, as well as the following values.

Return code Description
S_OK
The license key was successfully created.
E_NOTIMPL
This class factory does not support run-time license keys.
E_POINTER
The address passed in pbstrKey is not valid. For example, it may be NULL.
CLASS_E_NOTLICENSED
This class factory supports run-time licensing, but the current machine itself 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.

Notes to Callers

The caller must free the BSTR with the SysFreeString function 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 SysAllocStringLen, and the caller becomes responsible for this BSTR after this method returns successfully.

This method need not be implemented when a class factory does not support run-time license keys.

Requirements

Requirement Value
Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header ocidl.h

See also

IClassFactory2