回复 1# chen2j
没看你的代码,贴个以前写的
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>
TraySetClick(8)
Opt("TrayMenuMode", 3)
Opt("trayOnEventMode", 1)
TraySetOnEvent ($TRAY_EVENT_PRIMARYDOUBLE, "_showwin" )
$GUI = GUICreate("Form1",100,100)
$Button1 = GUICtrlCreateButton("确定", 5, 40, 80, 30)
GUISetState(@SW_SHOW)
$Eas = TrayCreateItem("关于")
TrayItemSetOnEvent($Eas, "TrayMsg")
$Exit = TrayCreateItem("退出")
TrayItemSetOnEvent($Exit, "TrayMsg")
While 1 ;窗体状态控制
$nMsg = GUIGetMsg()
Switch $nMsg
Case $Button1
MsgBox(0, "提示 " , "你点了窗体上的确定按钮",0,WinGetHandle("[active]"))
Case $GUI_EVENT_MINIMIZE
GUISetState(@SW_HIDE, $GUI)
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd
Func TrayMsg() ;系统托盘
Switch @TRAY_ID
Case $Eas
MsgBox(64, "关于", "这里是关于的内容")
Case $Exit
Exit
EndSwitch
EndFunc ;==>TrayMsg
Func _showwin()
GUISetState(@SW_SHOW, $GUI)
Return
EndFunc
|