回复 4# kk_lee69
看了这个范例的,但是里面还是有用到一个While循环Func Example()
TrayCreateItem("About")
TrayCreateItem("") ; Create a separator line.
TrayCreateItem("Exit")
TrayItemSetOnEvent(-1, "ExitScript")
TraySetOnEvent($TRAY_EVENT_PRIMARYDOUBLE, "TrayEvent")
TraySetOnEvent($TRAY_EVENT_SECONDARYUP, "TrayEvent")
TraySetState($TRAY_ICONSTATE_SHOW) ; Show the tray menu.
While 1
Sleep(100) ; An idle loop.
WEnd
EndFunc ;==>Example
Func TrayEvent()
Switch @TRAY_ID ; Check the last tray item identifier.
Case $TRAY_EVENT_PRIMARYDOUBLE
MsgBox($MB_SYSTEMMODAL, "", "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 $TRAY_EVENT_SECONDARYUP
MsgBox($MB_SYSTEMMODAL, "", "The secondary mouse button was released on the tray icon.")
EndSwitch
EndFunc ;==>TrayEvent
|