Skip to content

Latest commit

 

History

History
163 lines (120 loc) · 5.07 KB

nf-shlobj_core-shdefextracticonw.md

File metadata and controls

163 lines (120 loc) · 5.07 KB
UID title description helpviewer_keywords old-location tech.root ms.assetid ms.date ms.keywords req.header req.include-header req.target-type req.target-min-winverclnt req.target-min-winversvr req.kmdf-ver req.umdf-ver req.ddi-compliance req.unicode-ansi req.idl req.max-support req.namespace req.assembly req.type-library req.lib req.dll req.irql targetos req.typenames req.redist ms.custom f1_keywords dev_langs topic_type api_type api_location api_name req.apiset
NF:shlobj_core.SHDefExtractIconW
SHDefExtractIconW function (shlobj_core.h)
Provides a default handler to extract an icon from a file. (Unicode)
GIL_SIMULATEDOC
SHDefExtractIcon
SHDefExtractIcon function [Windows Shell]
SHDefExtractIconW
_win32_SHDefExtractIcon
shell.SHDefExtractIcon
shlobj_core/SHDefExtractIcon
shlobj_core/SHDefExtractIconW
shell\SHDefExtractIcon.htm
shell
fbaa600a-5e5c-4948-81fb-d2c3993dcd47
12/05/2018
GIL_SIMULATEDOC, SHDefExtractIcon, SHDefExtractIcon function [Windows Shell], SHDefExtractIconA, SHDefExtractIconW, _win32_SHDefExtractIcon, shell.SHDefExtractIcon, shlobj_core/SHDefExtractIcon, shlobj_core/SHDefExtractIconA, shlobj_core/SHDefExtractIconW
shlobj_core.h
Shlobj.h, Shlobj_core.h
Windows
Windows XP [desktop apps only]
Windows Server 2003 [desktop apps only]
SHDefExtractIconW (Unicode) and SHDefExtractIconA (ANSI)
Shell32.lib
Shell32.dll (version 6.0 or later)
Windows
19H1
SHDefExtractIconW
shlobj_core/SHDefExtractIconW
c++
APIRef
kbSyntax
DllExport
Shell32.dll
ext-ms-win-shell-shell32-l1-2-1.dll
Ext-MS-Win-Shell-Shell32-L1-2-2.dll
SHDefExtractIcon
SHDefExtractIconA
SHDefExtractIconW
ext-ms-win-shell-shell32-l1-2-1 (introduced in Windows 10, version 10.0.10240)

SHDefExtractIconW function

-description

Provides a default handler to extract an icon from a file.

-parameters

-param pszIconFile [in]

Type: LPCTSTR

A pointer to a null-terminated buffer that contains the path and name of the file from which the icon is extracted.

-param iIndex

Type: int

The location of the icon within the file named in pszIconFile. If this is a positive number, it refers to the zero-based position of the icon in the file. For instance, 0 refers to the 1st icon in the resource file and 2 refers to the 3rd. If this is a negative number, it refers to the icon's resource ID.

-param uFlags [in]

Type: UINT

A flag that controls the icon extraction.

GIL_SIMULATEDOC

Overlays the extracted icon on the default document icon to create the final icon. This icon can be used when no more appropriate icon can be found or retrieved.

-param phiconLarge [out, optional]

Type: HICON*

A pointer to an HICON that, when this function returns successfully, receives the handle of the large version of the icon specified in the LOWORD of nIconSize. This value can be NULL.

-param phiconSmall [out, optional]

Type: HICON*

A pointer to an HICON that, when this function returns successfully, receives the handle of the small version of the icon specified in the HIWORD of nIconSize.

-param nIconSize

Type: UINT

A value that contains the large icon size in its LOWORD and the small icon size in its HIWORD. Size is measured in pixels. Pass 0 to specify default large and small sizes.

- uFlags.GIL_SIMULATEDOC

Overlays the extracted icon on the default document icon to create the final icon. This icon can be used when no more appropriate icon can be found or retrieved.

-returns

Type: HRESULT

This function can return one of these values.

Return code Description
S_OK
Success.
S_FALSE
The requested icon is not present.
E_FAIL
The file cannot be accessed, or is being accessed through a slow link.

-remarks

It is the responsibility of the caller to free the icon resources created through this function when they are no longer needed. This can be done through the DestroyIcon function.

Note

The shlobj_core.h header defines SHDefExtractIcon as an alias which automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.