3 out of 3 rated this helpful - Rate this topic

PrivateExtractIcons function

[This function is not intended for general use. It may be altered or unavailable in subsequent versions of Windows.]

Applies to: desktop apps only

Creates an array of handles to icons that are extracted from a specified file.

Syntax

UINT WINAPI PrivateExtractIcons(
  __in       LPCTSTR lpszFile,
  __in       int nIconIndex,
  __in       int cxIcon,
  __in       int cyIcon,
  __out_opt  HICON *phicon,
  __out_opt  UINT *piconid,
  __in       UINT nIcons,
  __in       UINT flags
);

Parameters

lpszFile [in]

Type: LPCTSTR

The path and name of the file from which the icon(s) are to 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.

cxIcon [in]

Type: int

The horizontal icon size wanted. See Remarks.

cyIcon [in]

Type: int

The vertical icon size wanted. See Remarks.

phicon [out, optional]

Type: HICON*

A pointer to the returned array of icon handles.

piconid [out, optional]

Type: UINT*

A pointer to a returned resource identifier for the icon that best fits the current display device. The returned identifier is 0xFFFFFFFF if the identifier is not available for this format. The returned identifier is 0 if the identifier cannot otherwise be obtained.

nIcons [in]

Type: UINT

The number of icons to extract from the file. This parameter is only valid when extracting from .exe and .dll files.

flags [in]

Type: UINT

Specifies flags that control this function. These flags are the LR_* flags used by the LoadImage function.

Return value

Type: UINT

If the phicon parameter is NULL and this function succeeds, then the return value is the number of icons in the file. If the function fails then the return value is 0.

If the phicon parameter is not NULL and the function succeeds, then the return value is the number of icons extracted. Otherwise, the return value is 0xFFFFFFFF if the file is not found.

Remarks

This function extracts from executable (.exe), DLL (.dll), icon (.ico), cursor (.cur), animated cursor (.ani), and bitmap (.bmp) files. Extractions from Windows 3.x 16-bit executables (.exe or .dll) are also supported.

The cxIcon and cyIcon parameters specify the size of the icons to extract. Two sizes can be extracted by putting the first size in the LOWORD of the parameter and the second size in the HIWORD. For example, MAKELONG(24, 48) for both the cxIcon and cyIcon parameters would extract both 24 and 48 size icons.

You must destroy all icons extracted by PrivateExtractIcons by calling the DestroyIcon function.

This function was not included in the SDK headers and libraries until Windows XP Service Pack 1 (SP1) and Windows Server 2003. If you do not have a header file and import library for this function, you can call the function using LoadLibrary and GetProcAddress.

Requirements

Minimum supported client

Windows 2000 Professional

Minimum supported server

Windows 2000 Server

Header

Winuser.h

Library

User32.lib

DLL

User32.dll

Unicode and ANSI names

PrivateExtractIconsW (Unicode) and PrivateExtractIconsA (ANSI)

See also

Reference
DestroyIcon
ExtractIcon
ExtractIconEx
Conceptual
Icons

 

 

Send comments about this topic to Microsoft

Build date: 2/3/2012

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ