Share via


CComQIPtr::CoCreateInstance

HRESULT CoCreateInstance( REFCLSID rclsid**, LPUNKNOWN** pUnkOuter = NULL, DWORD dwClsContext = CLSCTX_ALL );

HRESULT CoCreateInstance( LPCOLESTR szProgID**, LPUNKNOWN** pUnkOuter = NULL, DWORD dwClsContext = CLSCTX_ALL );

Return value

A standard HRESULT value. Can be one of the following values:

  • S_OK

  • REGDB_E_CLASSNOTREG

  • CLASS_E_NOAGGREGATION

See in the Platform SDK for a list of possible return values.

Parameters

rclsid

[in] CLSID associated with the data and code that will be used to create the object.

pUnkOuter

[in] If NULL, indicates that the object is not being created as part of an aggregate. If non-NULL, pointer to the aggregate object's IUnknown interface (the controlling IUnknown).

dwClsContext

[in] Context in which the code that manages the newly created object will run.

szProgID

[in] ProgID associated with the data and code that will be used to create the object.

Remarks

Creates an instance of an object in a type-safe manner.

CComQIPtr OverviewClass Members