设置鼠标在系统托盘图标里面的点击模式 - 怎样的鼠标点击才会显示系统托盘的菜单.
TraySetClick ( 标志 )
标志 | 0 = 托盘菜单无论怎么点击都不会显示 1 = 按下鼠标主要按键(通常左键) 2 = 释放(松开)鼠标主要按键(通常左键) 4 = 双击鼠标主要按键(通常左键) 8 = 按下鼠标次要按键(通常右键) 16 = 释放(松开)鼠标次要按钮(通常右键) 32 = 双击鼠标次要按键(通常右键) 64 = 鼠标掠过系统托盘图标 |
#NoTrayIcon
Opt("TrayMenuMode", 3) ; 默认菜单项目 (脚本暂停中/退出)(Script Paused/Exit) 将不会显示,并且所选项目不能被选中(checkbox不会打勾) . 请参考TrayMenuMode选项1和2(3=1+2).
Example()
Func Example()
Local $iAbout = TrayCreateItem("关于")
TrayCreateItem("") ; Create a separator line.
Local $iExit = TrayCreateItem("退出")
TraySetState(1) ; Show the tray menu.
TraySetClick(64) ; Show the tray menu when the mouse if hovered over the tray icon.
While 1
Switch TrayGetMsg()
Case $iAbout ; Display a message box about the AutoIt version and installation path of the AutoIt executable.
MsgBox(4096, "", "AutoIt tray menu example." & @CRLF & @CRLF & _
"Version: " & @AutoItVersion & @CRLF & _
"Install Path: " & StringLeft(@AutoItExe, StringInStr(@AutoItExe, "\", 0, -1) - 1)) ; Find the folder of a full path.
Case $iExit ; Exit the loop.
ExitLoop
EndSwitch
WEnd
EndFunc ;==>Example