ImageList_CoCreateInstance function (commoncontrols.h)

Creates a single instance of an imagelist and returns an interface pointer to it.

Syntax

HRESULT ImageList_CoCreateInstance(
  [in]           REFCLSID       rclsid,
  [in, optional] const IUnknown *punkOuter,
  [in]           REFIID         riid,
  [out]          void           **ppv
);

Parameters

[in] rclsid

Type: REFCLSID

A reference to the CLSID—a GUID that identifies the COM object to be created. This should be CLSID_ImageList.

[in, optional] punkOuter

Type: const IUnknown*

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

[in] riid

Type: REFIID

Reference to the desired interface ID.

[out] ppv

Type: void**

When this method returns, contains the interface pointer requested in riid. This is normally IImageList2, which provides the Initialize method.

Return value

Type: HRESULT

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

Remarks

Before calling this function, COM must be initialized by calling CoInitialize or CoInitializeEx.

Call ImageList_CoCreateInstance for a customized image list; otherwise, call SHGetImageList to load the system image list. Call SHGetFileInfo with the uflag parameter set to SHGFI_SYSICONINDEX to retrieve a handle to the system image list.

Requirements

Requirement Value
Minimum supported client Windows Vista [desktop apps only]
Minimum supported server Windows Server 2008 [desktop apps only]
Target Platform Windows
Header commoncontrols.h
Library Comctl32.lib
DLL Comctl32.dll