Click or drag to resize

ShellUtilitiesExtractIcon Method

Extracts an icon from a file (.ico, .exe, etc.)

Namespace:  ShellBoost.Core.Utilities
Assembly:  ShellBoost.Core (in ShellBoost.Core.dll) Version: 1.8.3.0
Syntax
C#
public static IntPtr ExtractIcon(
	string iconFilePath,
	int index,
	int size = 0,
	GILIN flags = GILIN.GIL_NONE,
	bool throwOnError = true
)

Parameters

iconFilePath
Type: SystemString
The icon file path.
index
Type: SystemInt32
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.
size (Optional)
Type: SystemInt32
The required icon size.
flags (Optional)
Type: ShellBoost.Core.WindowsShellGILIN
Flags that control icon extraction.
throwOnError (Optional)
Type: SystemBoolean
if set to true errors may be throw in case of Windows Shell errors.

Return Value

Type: IntPtr
A handle to the extracted icon or Zero.
Exceptions
ExceptionCondition
ArgumentNullExceptioniconFilePath is null.
See Also