Export (0) Print
Expand All
3 out of 7 rated this helpful - Rate this topic

ExtractIconEx function

Creates an array of handles to large or small icons extracted from the specified executable file, DLL, or icon file.

Syntax


UINT WINAPI ExtractIconEx(
  _In_       LPCTSTR lpszFile,
  _In_       int nIconIndex,
  _Out_opt_  HICON *phiconLarge,
  _Out_opt_  HICON *phiconSmall,
  _In_       UINT nIcons
);

Parameters

lpszFile [in]

Type: LPCTSTR

The name of an executable file, DLL, or icon file from which icons will be extracted.

nIconIndex [in]

Type: int

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.

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.

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.

phiconLarge [out, optional]

Type: HICON*

An array of icon handles that receives handles to the large icons extracted from the file. If this parameter is NULL, no large icons are extracted from the file.

phiconSmall [out, optional]

Type: HICON*

An array of icon handles that receives handles to the small icons extracted from the file. If this parameter is NULL, no small icons are extracted from the file.

nIcons [in]

Type: UINT

The number of icons to be extracted from the file.

Return value

Type: UINT

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.

Remarks

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.

Requirements

Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]

Header

Shellapi.h

Library

Shell32.lib

DLL

Shell32.dll

Unicode and ANSI names

ExtractIconExW (Unicode) and ExtractIconExA (ANSI)

See also

Reference
DestroyIcon
ExtractIcon
Conceptual
Icons

 

 

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.