Creates a 32 bits-per-pixel bitmap from the specified icon.
#Include <WinAPIEx.au3>
_WinAPI_Create32BitHBITMAP ( $hIcon [, $fDib [, $fDelete]] )
$hIcon | Handle to the source icon. |
$fDib | [可选参数] Specifies whether to create device-independent (DIB) or device-dependent (DDB) bitmap, valid values: TRUE - Creates DIB. FALSE - Creates DDB. (Default) |
$fDelete | [可选参数] Specifies whether to delete the icon after the function is successful, valid values: TRUE - Icon will be deleted if the function succeeds. FALSE - Do not delete, you must release the icon when you are finished using it. (Default) |
Success | Handle to the created bitmap. |
失败: | 返回 0 并设置 @error 标志为非 0 值. |
#NoTrayIcon
#Include <GUIMenu.au3>
#Include <WinAPIEx.au3>
Opt('MustDeclareVars', 1)
Opt('TrayMenuMode', 3)
If _WinAPI_GetVersion() < '6.0' Then
MsgBox(16, 'Error', 'Require Windows Vista or later.')
Exit
EndIf
Global $hMenu, $Options, $Exit
$hMenu = TrayItemGetHandle(0)
$Options = TrayCreateItem('Options')
TrayCreateItem('')
$Exit = TrayCreateItem('Exit')
_GUICtrlMenu_SetItemBmp($hMenu, 0, _WinAPI_Create32BitHBITMAP(_WinAPI_ShellExtractIcon(@SystemDir & '\shell32.dll', 207, 16, 16), 1, 1))
_GUICtrlMenu_SetItemBmp($hMenu, 2, _WinAPI_Create32BitHBITMAP(_WinAPI_ShellExtractIcon(@SystemDir & '\shell32.dll', 131, 16, 16), 1, 1))
TraySetState()
Do
Until TrayGetMsg() = $Exit