ICreateObject::CreateObject method (propsys.h)

Creates a local object of a specified class and returns a pointer to a specified interface on the object.

Syntax

HRESULT CreateObject(
  [in]  REFCLSID clsid,
  [in]  IUnknown *pUnkOuter,
  [in]  REFIID   riid,
  [out] void     **ppv
);

Parameters

[in] clsid

Type: REFCLSID

A reference to a CLSID.

[in] pUnkOuter

Type: IUnknown*

A pointer to the IUnknown interface that aggregates the object created by this function, or NULL if no aggregation is desired.

[in] riid

Type: REFIID

A reference to the IID of the interface the created object should return.

[out] ppv

Type: void**

When this method returns, contains the address of the pointer to the interface requested in riid.

Return value

Type: HRESULT

If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Remarks

This method can be used with GetPropertyStoreWithCreateObject.

Requirements

Requirement Value
Minimum supported client Windows Vista [desktop apps only]
Minimum supported server Windows Server 2008 [desktop apps only]
Target Platform Windows
Header propsys.h