SimpleClassFactory::CreateInstance Method

Creates an instance of the specified interface.

STDMETHOD(
   CreateInstance
)
   (_Inout_opt_ IUnknown* pUnkOuter, 
   REFIID riid, 
   _Deref_out_ void** ppvObject);

Parameters

  • pUnkOuter
    Must be nullptr; otherwise, the return value is CLASS_E_NOAGGREGATION.

    SimpleClassFactory doesn't support aggregation. If aggregation were supported and the object being created was part of an aggregate, pUnkOuter would be a pointer to the controlling IUnknown interface of the aggregate.

  • riid
    Interface ID of the object to create.

  • ppvObject
    When this operation completes, pointer to an instance of the object specified by the riid parameter.

Return Value

S_OK if successful; otherwise, an HRESULT that indicates the error.

Remarks

If __WRL_STRICT__ is defined, an assert error is emitted if the base class specified in the class template parameter isn't derived from RuntimeClass, or isn't configured with the ClassicCom or WinRtClassicComMix RuntimeClassType enumeration value.

Requirements

Header: module.h

Namespace: Microsoft::WRL

See Also

Reference

SimpleClassFactory Class