Partager via


IClassFactory2::RequestLicKey (Windows CE 5.0)

Send Feedback

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.

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 Values

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

OS Versions: Windows CE 3.0 and later.
Header: Ocidl.h, Ocidl.idl.
Link Library: Ole32.lib, Uuid.lib.

See Also

IClassFactory2::CreateInstanceLic | IClassFactory2::GetLicInfo

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.