Shell_GetCachedImageIndexW function (shlobj_core.h)

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

Retrieves the cache index of a cached icon.

Syntax

int Shell_GetCachedImageIndexW(
  LPCWSTR pszIconPath,
  int     iIconIndex,
  UINT    uIconFlags
);

Parameters

pszIconPath

TBD

iIconIndex

Type: int

The index of the image within the file named at pwszIconPath.

uIconFlags

Type: UINT

Not used.

Return value

Type: int

Returns the index of the image, or –1 on failure.

Remarks

The Shell_GetCachedImageIndexA and Shell_GetCachedImageIndexW versions of this function were added in Windows Vista. For Unicode strings, call either Shell_GetCachedImageIndexW or Shell_GetCachedImageIndex. For ANSI strings, you must call Shell_GetCachedImageIndexA explicitly.

Windows Server 2003 and Windows XP:  Only Shell_GetCachedImageIndex is supported. Shell_GetCachedImageIndex requires a Unicode string.

Note

The shlobj_core.h header defines Shell_GetCachedImageIndex as an alias that automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that is not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.

Requirements

Requirement Value
Minimum supported client Windows XP [desktop apps only]
Minimum supported server Windows Server 2003 [desktop apps only]
Target Platform Windows
Header shlobj_core.h (include Shlobj.h, Shlobj_core.h, Shlobj.h, Shlobj_core.h)
Library Shell32.lib
DLL Shell32.dll (version 5.0 or later)
API set ext-ms-win-shell-shell32-l1-2-1 (introduced in Windows 10, version 10.0.10240)

See also

FileIconInit