Partager via


IClassFactory2::RequestLicKey

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

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, ocidl.idl
Library ole32.lib, uuid.lib
Windows Embedded CE Windows CE 3.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also

Reference

IClassFactory2::CreateInstanceLic
IClassFactory2::GetLicInfo