This function retrieves icon handles from the specified executable file or dynamic-link library (DLL).
HICON ExtractIconEx( LPCTSTR lpszFile, int nIconIndex, HICON FAR* phiconLarge, HICON FAR* phiconSmall, UINT nIcons );
[in] Long pointer to a null-terminated string that specifies the name of an executable file or DLL file from which to extract icons.
[in] Specifies the zero-based index of the first icon to extract. For example, if this value is zero, the function extracts the first icon in the specified file.
For Windows CE 2.10 and later, the nIconIndex parameter must be zero or –N, where N is a specified resource identifier. The nIcons parameter must be 1.
For Windows CE 1.0 through 2.10, the function returns the total number of icons in the specified file if nIconIndex is –1 and phIconLarge and phiconSmall are both NULL. 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.
[in, out] Pointer to an array to receive handles to large icons extracted from the file. If this parameter is NULL, no large icons are extracted from the file.
[in, out] Pointer to an array to receive handles to small icons extracted from the file. If this parameter is NULL, no small icons are extracted from the file.
[in] Specifies the number of icons to extract from the file. For Windows CE 2.10 and later, the nIcons parameter must be 1.
For Windows CE 2.10 and later, this function returns the handle to the first icon in the retrieved icon array. If both phiconLarge and phiconSmall are not NULL, the return value defaults to the first large icon.
For Windows CE 1.0 through 2.10, this function returns a UINT data type. If the nIconIndex parameter is –1, the phiconLarge parameter is NULL, and the phiconSmall parameter is NULL, 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.
Your application must destroy all icons extracted by this function by calling the DestroyIcon function for each icon. Note that destruction of all the icons in the retrieved array also destroys the returned icon.
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.