得到一个系统托盘图标项目产生的事件.
TrayGetMsg ( )
0 | 没有事件发生 |
Control ID | 发送消息的控件标识 |
$TRAY_EVENT_PRIMARYDOWN | 鼠标主要按键被点击(默认左键) |
$TRAY_EVENT_PRIMARYUP | 鼠标主要按键被释放(默认左键) |
$TRAY_EVENT_SECONDARYDOWN | 鼠标次要按键被点击(默认右键) |
$TRAY_EVENT_SECONDARYUP | 鼠标次要按键被释放(默认右键) |
$TRAY_EVENT_PRIMARYDOUBLE | 鼠标主要按键双击(默认左键) |
$TRAY_EVENT_SECONDARYDOUBLE | 鼠标次要按键双击(默认右键) |
#NoTrayIcon
Opt("TrayMenuMode", 3) ; 默认菜单项目 (脚本暂停中/退出)(Script Paused/Exit) 将不会显示,并且所选项目不能被选中(checkbox不会打勾) . 请参考TrayMenuMode选项1和2(3=1+2).
Example()
Func Example()
Local $iAbout = TrayCreateItem("关于")
TrayCreateItem("") ; 创建一个分割条.
Local $iExit = TrayCreateItem("退出")
TraySetState(1) ; 显示托盘菜单.
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