Export (0) Print
Expand All
Expand Minimize

SHCoCreateInstance function

[SHCoCreateInstance is available for use in the operating systems specified in the Requirements section. It may be altered or unavailable in subsequent versions. Instead, use CoCreateInstance.]

Creates Component Object Model (COM) objects that are implemented in Shell32.dll.

Syntax


HRESULT SHCoCreateInstance(
  _In_opt_  PCWSTR pszCLSID,
  _In_opt_  const CLSID *pclsid,
  _In_opt_  IUnknown *pUnkOuter,
  _In_      REFIID riid,
  _Out_     void **ppv
);

Parameters

pszCLSID [in, optional]

Type: PCWSTR

A pointer to a string to convert to a CLSID. If NULL, pclsid is used as the CLSID.

pclsid [in, optional]

Type: const CLSID*

The CLSID to create.

pUnkOuter [in, optional]

Type: IUnknown*

A pointer to outer IUnknown. Used for aggregation.

riid [in]

Type: REFIID

A reference to the IID of the interface to retrieve through ppv.

ppv [out]

Type: void**

When this function returns successfully, receives the interface pointer requested in riid.

Return value

Type: HRESULT

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

Remarks

We recommend that you use the IID_PPV_ARGS macro, defined in Objbase.h, to package the riid and ppv parameters. This macro provides the correct IID based on the interface pointed to by the value in ppv, which eliminates the possibility of a coding error in riid that could lead to unexpected results.

Requirements

Minimum supported client

Windows XP [desktop apps only]

Minimum supported server

Windows Server 2003 [desktop apps only]

End of client support

Windows XP with SP2

End of server support

Windows Server 2003

Header

Shlobj.h

Library

Shell32.lib

DLL

Shell32.dll (version 5.0 or later)

 

 

Community Additions

ADD
Show:
© 2014 Microsoft