|
发表于 2009-8-30 21:50:52
|
显示全部楼层
楼主可以参考这个#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>
Global $XL = 250 , $YL = 280
Opt("GUIOnEventMode", 1)
Opt("TrayOnEventMode", 1)
Opt("TrayMenuMode", 1)
$setnet = TrayCreateItem("设置")
TrayCreateItem("")
$aboutitem = TrayCreateItem("关于")
TrayCreateItem("")
$Exit = TrayCreateItem("退出")
TraySetState()
TrayItemSetOnEvent($setnet,"TrayMsg");注册托盘事件
TrayItemSetOnEvent($aboutitem,"TrayMsg")
TrayItemSetOnEvent($Exit,"TrayMsg")
TraySetOnEvent($TRAY_EVENT_PRIMARYDOWN, "TrayMsg");注册双击托盘事件
$hGUI = GUICreate("窗口1", 600, 400, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_SYSMENU))
$ie = ObjCreate("Shell.Explorer.2")
$Obj = GUICtrlCreateObj($ie, 0,0 ,690,900)
$ie.navigate("http://www.baidu.com")
GUISetOnEvent($GUI_EVENT_MINIMIZE, "GUICtrlMsg")
GUISetOnEvent($GUI_EVENT_CLOSE, "GUICtrlMsg")
$GUI2 = GUICreate ( "设置" , $XL , $YL ,@DesktopWidth - ($XL+9), @DesktopHeight - ($YL+55), BitOR($WS_MINIMIZEBOX, $WS_SYSMENU))
$ie = ObjCreate("Shell.Explorer.2")
$Obj = GUICtrlCreateObj($ie, 0,0 ,690,900)
$ie.navigate("http://www.qq.com")
GUISetOnEvent($GUI_EVENT_CLOSE, "GUICtrlMsg")
GUISwitch($hGUI) ;切换主窗口
GUISetState(@SW_SHOW) ;显示当前窗口
While 1
Sleep(1100)
WEnd
Func GUICtrlMsg();选择产生消息的 GUI事件
Switch @GUI_CtrlId
Case $GUI_EVENT_CLOSE
GUISetState(@SW_HIDE,@GUI_WinHandle); 隐藏主窗口
Case $GUI_EVENT_MINIMIZE
GUISetState(@SW_HIDE, $hGUI);还是隐藏主窗口
EndSwitch
EndFunc
Func TrayMsg()
Switch @TRAY_ID ;选择产生消息的 TrayItem 或其它特殊事件(如鼠标左键双击事件)
Case $TRAY_EVENT_PRIMARYDOWN
GUISetState(@SW_SHOW, $hGUI); 双击托盘显示 主窗口
Case $setnet
GUISetState(@SW_SHOW,$GUI2); 显示 子窗口 1
Case $aboutitem
Msgbox(64, "关于:", "AutoIt3-托盘-例子.");弹出消息提示
Case $Exit
Quit();退出
EndSwitch
EndFunc
Func Quit()
Exit
EndFunc |
|