Function Reference


Retrieves information about the specified icon or cursor

#include <WinAPIIcons.au3>
_WinAPI_GetIconInfoEx ( $hIcon )


$hIcon Handle to the icon or cursor. To retrieve information about a standard icon or cursor, use $IDC_* constants.

Return Value

Success: The array that contains the following information:
    [0] - A value of 1 specifies an icon; 0 specifies a cursor.
    [1] - The x-coordinate of the cursor's hot spot.
    [2] - The y-coordinate of the cursor's hot spot.
    [3] - A handle to the icon bitmask bitmap.
    [4] - A handle to the icon color bitmap.
    [5] - The icon or cursor resource bits.
    [6] - The fully qualified path of the module.
    [7] - The fully qualified path of the resource.
Failure: Sets the @error flag to non-zero.


The _WinAPI_GetIconInfoEx() creates bitmaps [3] and [4].
The calling application must manage these bitmaps and delete them when they are no longer necessary.

This function requires Windows Vista or later.

See Also

Search GetIconInfoEx in MSDN Library.


#include <MsgBoxConstants.au3>
#include <WinAPIIcons.au3>
#include <WinAPIRes.au3>
#include <WinAPISys.au3>

If Number(_WinAPI_GetVersion()) < 6.0 Then
    MsgBox(BitOR($MB_ICONERROR, $MB_SYSTEMMODAL), 'Error', 'Require Windows Vista or later.')

Local $hInstance = _WinAPI_LoadLibraryEx(@AutoItExe, $LOAD_LIBRARY_AS_DATAFILE)
Local $hIcon = _WinAPI_LoadImage($hInstance, 99, $IMAGE_ICON, 0, 0, $LR_DEFAULTSIZE)
Local $aInfo = _WinAPI_GetIconInfoEx($hIcon)
If IsArray($aInfo) Then
    ConsoleWrite('Handle: ' & $hIcon & @CRLF)
    ConsoleWrite('Path:   ' & $aInfo[6] & @CRLF)
    ConsoleWrite('ID:     ' & $aInfo[5] & @CRLF)
    For $i = 3 To 4