函数参考


_WinAPI_GetIconInfoEx

Retrieves information about the specified icon or cursor.

#Include <WinAPIEx.au3>
_WinAPI_GetIconInfoEx ( $hIcon )

参数

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

返回值

Success The array that contains the following information:
[0] A value of 1 specifies an icon0 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.
失败: 返回 0 并设置 @error 标志为非 0 值.

注意/说明

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

本函数需要 Windows Vista 或更高版本系统.

相关

详情参考

在MSDN中搜索


示例/演示


#Include <APIConstants.au3>
#Include <WinAPIEx.au3>

Opt('MustDeclareVars', 1)

If _WinAPI_GetVersion() < '6.0' Then
    MsgBox(16, 'Error', 'Require Windows Vista or later.')
    Exit
EndIf

Global $hInstance, $hIcon, $aInfo

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