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 值. |
在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)