Windows Dev Center

IClassFactory2::RequestLicKey method

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

dwReserved [in]

This parameter is reserved and must be zero.

pBstrKey [out]

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 codeDescription
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

Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]

Header

OCIdl.h

IDL

OCIdl.idl

IID

IID_IClassFactory2 is defined as B196B28F-BAB4-101A-B69C-00AA00341D07

See also

IClassFactory2

 

 

Community Additions

ADD
Show:
© 2015 Microsoft