SHGetStockIconInfo function (shellapi.h)

Retrieves information about system-defined Shell icons.

Syntax

SHSTDAPI SHGetStockIconInfo(
            SHSTOCKICONID   siid,
            UINT            uFlags,
  [in, out] SHSTOCKICONINFO *psii
);

Parameters

siid

Type: SHSTOCKICONID

One of the values from the SHSTOCKICONID enumeration that specifies which icon should be retrieved.

uFlags

Type: UINT

A combination of zero or more of the following flags that specify which information is requested.

SHGSI_ICONLOCATION

The szPath and iIcon members of the SHSTOCKICONINFO structure receive the path and icon index of the requested icon, in a format suitable for passing to the ExtractIcon function. The numerical value of this flag is zero, so you always get the icon location regardless of other flags.

SHGSI_ICON

The hIcon member of the SHSTOCKICONINFO structure receives a handle to the specified icon.

SHGSI_SYSICONINDEX

The iSysImageImage member of the SHSTOCKICONINFO structure receives the index of the specified icon in the system imagelist.

SHGSI_LINKOVERLAY

Modifies the SHGSI_ICON value by causing the function to add the link overlay to the file's icon.

SHGSI_SELECTED

Modifies the SHGSI_ICON value by causing the function to blend the icon with the system highlight color.

SHGSI_LARGEICON

Modifies the SHGSI_ICON value by causing the function to retrieve the large version of the icon, as specified by the SM_CXICON and SM_CYICON system metrics.

SHGSI_SMALLICON

Modifies the SHGSI_ICON value by causing the function to retrieve the small version of the icon, as specified by the SM_CXSMICON and SM_CYSMICON system metrics.

SHGSI_SHELLICONSIZE

Modifies the SHGSI_LARGEICON or SHGSI_SMALLICON values by causing the function to retrieve the Shell-sized icons rather than the sizes specified by the system metrics.

[in, out] psii

Type: SHSTOCKICONINFO*

A pointer to a SHSTOCKICONINFO structure. When this function is called, the cbSize member of this structure needs to be set to the size of the SHSTOCKICONINFO structure. When this function returns, contains a pointer to a SHSTOCKICONINFO structure that contains the requested information.

Return value

Type: HRESULT

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

Remarks

If this function returns an icon handle in the hIcon member of the SHSTOCKICONINFO structure pointed to by psii, you are responsible for freeing the icon with DestroyIcon when you no longer need it.

Requirements

Requirement Value
Minimum supported client Windows Vista [desktop apps only]
Minimum supported server Windows Server 2008 [desktop apps only]
Target Platform Windows
Header shellapi.h
DLL Shell32.dll
API set ext-ms-win-shell-shell32-l1-2-1 (introduced in Windows 10, version 10.0.10240)