IExtractIconA::Extract method (shlobj_core.h)

Extracts an icon image from the specified location.

Syntax

HRESULT Extract(
  [in]            PCSTR pszFile,
                  UINT  nIconIndex,
  [out, optional] HICON *phiconLarge,
  [out, optional] HICON *phiconSmall,
                  UINT  nIconSize
);

Parameters

[in] pszFile

Type: PCTSTR

A pointer to a null-terminated string that specifies the icon location.

nIconIndex

Type: UINT

The index of the icon in the file pointed to by pszFile.

[out, optional] phiconLarge

Type: HICON*

A pointer to an HICON value that receives the handle to the large icon. This parameter may be NULL.

[out, optional] phiconSmall

Type: HICON*

A pointer to an HICON value that receives the handle to the small icon. This parameter may be NULL.

nIconSize

Type: UINT

The desired size of the icon, in pixels. The low word contains the size of the large icon, and the high word contains the size of the small icon. The size specified can be the width or height. The width of an icon always equals its height.

Return value

Type: HRESULT

Returns S_OK if the function extracted the icon, or S_FALSE if the calling application should extract the icon.

Remarks

The icon location and index are the same values returned by the IExtractIcon::GetIconLocation method. If IExtractIcon::Extract function returns S_FALSE, these values must specify an icon file name and index that form legal parameters for a call to ExtractIcon. If IExtractIcon::Extract does not return S_FALSE, no assumptions should be made about the meanings of the pszFile and nIconIndex parameters.

Requirements

Requirement Value
Minimum supported client Windows XP [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header shlobj_core.h
DLL Shell32.dll (version 4.0 or later)

See also

IExtractIcon