Shell32SHDefExtractIcon Method
Provides a default handler to extract an icon from a file.
Namespace: DevCase.Win32.NativeMethodsAssembly: DevCase.net48 (in DevCase.net48.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
[DllImportAttribute("Shell32.dll", CharSet = CharSet.Auto, BestFitMapping = false,
ThrowOnUnmappableChar = true)]
public static HResult SHDefExtractIcon(
string iconFile,
int iconIndex,
uint flags,
ref IntPtr refHiconLarge,
ref IntPtr refHiconSmall,
uint iconSize
)
<DllImportAttribute("Shell32.dll", CharSet := CharSet.Auto, BestFitMapping := false,
ThrowOnUnmappableChar := true>]
Public Shared Function SHDefExtractIcon (
iconFile As String,
iconIndex As Integer,
flags As UInteger,
ByRef refHiconLarge As IntPtr,
ByRef refHiconSmall As IntPtr,
iconSize As UInteger
) As HResult
Dim iconFile As String
Dim iconIndex As Integer
Dim flags As UInteger
Dim refHiconLarge As IntPtr
Dim refHiconSmall As IntPtr
Dim iconSize As UInteger
Dim returnValue As HResult
returnValue = Shell32.SHDefExtractIcon(iconFile,
iconIndex, flags, refHiconLarge,
refHiconSmall, iconSize)
public:
[DllImportAttribute(L"Shell32.dll", CharSet = CharSet::Auto, BestFitMapping = false,
ThrowOnUnmappableChar = true)]
static HResult SHDefExtractIcon(
String^ iconFile,
int iconIndex,
unsigned int flags,
IntPtr% refHiconLarge,
IntPtr% refHiconSmall,
unsigned int iconSize
)
[<DllImportAttribute("Shell32.dll", CharSet = CharSet.Auto, BestFitMapping = false,
ThrowOnUnmappableChar = true)>]
static member SHDefExtractIcon :
iconFile : string *
iconIndex : int *
flags : uint32 *
refHiconLarge : IntPtr byref *
refHiconSmall : IntPtr byref *
iconSize : uint32 -> HResult
No code example is currently available or this language may not be supported.
- iconFile String
-
A pointer to a null-terminated buffer that contains the path and name of the file from which the icon is extracted.
- iconIndex Int32
-
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.
- flags UInt32
-
A flag that controls the icon extraction.
- refHiconLarge IntPtr
-
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 Zero.
- refHiconSmall IntPtr
-
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 iconSize param.
This value can be Zero.
- iconSize UInt32
-
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.
HResult
This function can return one of these values:
S_OK,
S_FALSE or
E_FAIL.