创建指定大小,颜色,位模式的图标.
#Include <WinAPIEx.au3>
_WinAPI_CreateIcon ( $hInstance, $iWidth, $iHeight, $iPlanes, $iBitsPixel, $pANDBits, $pXORBits )
$hInstance | 创建图标的模块句柄. |
$iWidth | 图标宽度像素值. |
$iHeight | 图标高度像素值. |
$iPlanes | 图标的 XOR 掩码平面位数. |
$iBitsPixel | 图标的 XOR 掩码每像素数. |
$pANDBits | 包含图标 AND 掩码位值的字节数组. 这个位掩码描述一个单色位图. |
$pXORBits | 包含图标 XOR 掩码位值的字节数组. 这个位掩码描述一个单色或依赖于设备的彩色位图. |
成功: | 返回创建的图标句柄. |
失败: | 返回 0,设置 the @error 为非 0 值. |
在MSDN中搜索
#Include <WinAPIEx.au3>
Opt('MustDeclareVars', 1)
Global Const $STM_SETIMAGE = 0x0172
Global Const $sANDBits = _
'FF FF FF FF' & _
'FF FF C3 FF' & _
'FF FF 00 FF' & _
'FF FE 00 7F' & _
'FF FC 00 1F' & _
'FF F8 00 0F' & _
'FF F8 00 0F' & _
'FF F0 00 07' & _
'FF F0 00 03' & _
'FF E0 00 03' & _
'FF E0 00 01' & _
'FF E0 00 01' & _
'FF F0 00 01' & _
'FF F0 00 00' & _
'FF F8 00 00' & _
'FF FC 00 00' & _
'FF FF 00 00' & _
'FF FF 80 00' & _
'FF FF E0 00' & _
'FF FF E0 01' & _
'FF FF F0 01' & _
'FF FF F0 01' & _
'FF FF F0 03' & _
'FF FF E0 03' & _
'FF FF E0 07' & _
'FF FF C0 0F' & _
'FF FF C0 0F' & _
'FF FF 80 1F' & _
'FF FF 00 7F' & _
'FF FC 00 FF' & _
'FF F8 03 FF' & _
'FF FC 3F FF'
Global Const $sXORBits = _
'00 00 00 00' & _
'00 00 00 00' & _
'00 00 00 00' & _
'00 00 00 00' & _
'00 00 00 00' & _
'00 00 00 00' & _
'00 00 00 00' & _
'00 00 38 00' & _
'00 00 7C 00' & _
'00 00 7C 00' & _
'00 00 7C 00' & _
'00 00 38 00' & _
'00 00 00 00' & _
'00 00 00 00' & _
'00 00 00 00' & _
'00 00 00 00' & _
'00 00 00 00' & _
'00 00 00 00' & _
'00 00 00 00' & _
'00 00 00 00' & _
'00 00 00 00' & _
'00 00 00 00' & _
'00 00 00 00' & _
'00 00 00 00' & _
'00 00 00 00' & _
'00 00 00 00' & _
'00 00 00 00' & _
'00 00 00 00' & _
'00 00 00 00' & _
'00 00 00 00' & _
'00 00 00 00' & _
'00 00 00 00'
Global $tANDBits, $pANDBits, $tXORBits, $pXORBits, $bData, $hIcon
; Create AND bitmask structure
$bData = Binary('0x' & StringStripWS($sANDBits, 8))
$tANDBits = DllStructCreate('byte[' & BinaryLen($bData)& ']')
$pANDBits = DllStructGetPtr($tANDBits)
DllStructSetData($tANDBits, 1, $bData)
; Create XOR bitmask structure
$bData = Binary('0x' & StringStripWS($sXORBits, 8))
$tXORBits = DllStructCreate('byte[' & BinaryLen($bData)& ']')
$pXORBits = DllStructGetPtr($tXORBits)
DllStructSetData($tXORBits, 1, $bData)
; Create monochrome icon (32x32)
$hIcon = _WinAPI_CreateIcon(0, 32, 32, 1, 1, $pANDBits, $pXORBits)
; 创建 GUI
GUICreate('MyGUI', 128, 128)
GUICtrlCreateIcon('', 0, 48, 48, 32, 32)
GUICtrlSendMsg(-1, $STM_SETIMAGE, 1, $hIcon)
GUISetState()
Do
Until GUIGetMsg() = -3