本帖最后由 netegg 于 2011-5-13 03:21 编辑 #include <Constants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Opt("TrayOnEventMode", 1)
Opt("TrayMenuMode", 1) ;默认菜单项目 (脚本暂停中/退出)(Script Paused/Exit) 将不会显示.
GUICreate("My GUI") ; 创建一个居中显示的 GUI 窗口
GUISetState(@SW_SHOW)
TraySetOnEvent($TRAY_EVENT_PRIMARYDOWN, "SpecialEvent")
TraySetOnEvent($TRAY_EVENT_SECONDARYDOWN, "SpecialEvent")
TraySetState()
While 1
Sleep(10) ; 空闲循环
WEnd
Exit
Func SpecialEvent()
$state = WinGetState("My GUI", "")
Select
Case @TRAY_ID = $TRAY_EVENT_PRIMARYDOWN
If $state = 7 Then
GUISetState(@SW_HIDE)
Else
If $state = 5 Then
GUISetState(@SW_SHOW)
EndIf
EndIf
Case @TRAY_ID = $TRAY_EVENT_SECONDARYDOWN
ExitEvent()
EndSelect
EndFunc ;==>SpecialEvent
Func ExitEvent()
Exit
EndFunc ;==>ExitEvent
写完了忽然觉得好像和楼主的问题有点答非所问,大概意思吧 |