函数参考


_WinAPI_AddIconOverlay

通过合并图标和遮盖掩码创建图标

#Include <WinAPIEx.au3>
_WinAPI_AddIconOverlay ( $hIcon, $hOverlay )

参数

$hIcon 原始图标句柄
$hOverlay 用作遮盖层的图标句柄

返回值

成功: 新建图标句柄
失败: 返回 0并设置@error非0

注意/说明

The source and overlay icons must be the same size but can have different color depth. This function internally
converts the specified icons to the 32 bits-per-pixel icon.

图标使用完毕后, 使用_WinAPI_DestroyIcon()销毁.

相关

详情参考

None

示例/演示


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

Opt('MustDeclareVars', 1)

Global Const $STM_SETIMAGE = 0x0172

Global $hIcon, $hOverlay, $hResult

; 创建带遮罩(层叠)的图标(48x48)
$hIcon = _WinAPI_ShellExtractIcon(@SystemDir & '\shell32.dll', 1, 32, 32)
If _WinAPI_GetVersion() >= '6.0' Then
    $hOverlay = _WinAPI_ShellExtractIcon(@SystemDir & '\imageres.dll', 154, 32, 32)
Else
    $hOverlay = _WinAPI_ShellExtractIcon(@SystemDir & '\shell32.dll', 29, 32, 32)
EndIf
$hResult = _WinAPI_AddIconOverlay($hIcon, $hOverlay)
_WinAPI_DestroyIcon($hIcon)
_WinAPI_DestroyIcon($hOverlay)

; 创建 GUI
GUICreate('MyGUI', 128, 128)
GUICtrlCreateIcon('', 0, 48, 48, 32, 32)
GUICtrlSendMsg(-1, $STM_SETIMAGE, 1, $hResult)
GUISetState()

Do
Until GUIGetMsg() = -3