CComPtr::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:

See CoCreateInstance in the Platform SDK for a description 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, a 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.

CComPtr OverviewClass Members