The ExtractIconEx function creates an array of handles to large or small icons extracted from the specified executable file, dynamic-link library (DLL), or icon file.
UINT ExtractIconEx(
LPCTSTR lpszFile,
int nIconIndex,
HICON FAR *phiconLarge,
HICON FAR *phiconSmall,
UINT nIcons
);
If this value is –1 and phIconLarge and phiconSmall are both NULL, the function returns the total number of icons in the specified file. If the file is an executable file or DLL, the return value is the number of RT_GROUP_ICON resources. If the file is an .ICO file, the return value is 1.
Windows 95, Windows NT 4.0, and later: If this value is a negative number and either phIconLarge or phiconSmall is not NULL, the function begins by extracting the icon whose resource identifier is equal to the absolute value of nIconIndex. For example, use -3 to extract the icon whose resource identifier is 3.
If the nIconIndex parameter is -1, the phiconLarge parameter is NULL, and the phiconSmall parameter is NULL, then the return value is the number of icons contained in the specified file. Otherwise, the return value is the number of icons successfully extracted from the file.
You must destroy all icons extracted by ExtractIconEx by calling the DestroyIcon function.
To retrieve the dimensions of the large and small icons, use the GetSystemMetrics function with the SM_CXICON, SM_CYICON, SM_CXSMICON, and SM_CYSMICON flags.
Windows CE: The nIconIndex parameter must be zero or –N where N is a specified resource identifier. The nIcons parameter must be 1.
Windows NT: Requires version 3.5 or later.
Windows: Requires Windows 95 or later.
Windows CE: Requires version 1.0 or later.
Header: Declared in shellapi.h.
Import Library: Use shell32.lib.
Unicode: Implemented as Unicode and ANSI versions on Windows NT.
Icons Overview, Icon Functions, DestroyIcon, ExtractIcon