CComClassFactoryAutoThread::CreateInstance

Creates an object of the specified CLSID and retrieves an interface pointer to this object.

STDMETHODIMP CreateInstance(
   LPUNKNOWN pUnkOuter,
   REFIID riid,
   void** ppvObj 
);

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.

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

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

Return Value

A standard HRESULT value.

Remarks

If your module derives from CComAutoThreadModule, CreateInstance first selects a thread to create the object in the associated apartment.

Requirements

Header: atlcom.h

See Also

Reference

CComClassFactoryAutoThread Class

CoCreateInstance

CoGetClassObject

Other Resources

CComClassFactoryAutoThread Members