共用方式為


CComClassFactory2::CreateInstanceLic

Similar to CreateInstance, except that CreateInstanceLic requires a license key.

STDMETHOD(CreateInstanceLic)(
   IUnknown* pUnkOuter,
   IUnknown* /* pUnkReserved */,
   REFIID riid,
   BSTR bstrKey,
   void** ppvObject 
);

Parameters

  • pUnkOuter
    [in] If the object is being created as part of an aggregate, then pUnkOuter must be the outer unknown. Otherwise, pUnkOuter must be NULL.

  • pUnkReserved
    [in] Not used. Must be NULL.

  • riid
    [in] The IID of the requested interface. If pUnkOuter is non-NULL, riid must be IID_IUnknown.

  • bstrKey
    [in] The run-time license key previously obtained from a call to RequestLicKey. This key is required to create the object.

  • ppvObject
    [out] A pointer to the interface pointer specified by riid. If the object does not support this interface, ppvObject is set to NULL.

Return Value

A standard HRESULT value.

Remarks

You can obtain a license key using RequestLicKey. In order to create an object on an unlicensed machine, you must call CreateInstanceLic.

Requirements

Header: atlcom.h

See Also

Reference

CComClassFactory2 Class

CoCreateInstance

CoGetClassObject

Other Resources

CComClassFactory2 Members