回复 xiehuahere
我仔细看看帮助改改吧,谢谢您!
开机只启动托盘,但不启打开窗口怎么做?
天之骄子 发表于 2012-11-22 16:42 #include <GUIConstantsEx.au3>
#include <Constants.au3>
Opt("TrayMenuMode", 1)
Opt("TrayOnEventMode", 1)
Opt("GUIOnEventMode", 1)
Local $sRegPath = 'HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run'
$Form1 = GUICreate("窗口", 321, 192, -1, -1, -1, -1, WinGetHandle(AutoItWinGetTitle()))
GUISetOnEvent($GUI_EVENT_CLOSE, "Form1Close")
If Not $CmdLine[0] Then GUISetState(@SW_SHOW)
GUISetOnEvent($GUI_EVENT_MINIMIZE, "Form1");点最小化后,隐藏界面
TraySetOnEvent($TRAY_EVENT_PRIMARYDOUBLE, "TrayEvent");双击托盘后显示界面开始
$guanyu = TrayCreateItem("关于") ;托盘菜单源码开始
TrayItemSetOnEvent(-1, 'TrayEvent')
$fangwen = TrayCreateItem("访问")
TrayItemSetOnEvent(-1, 'TrayEvent')
$settingsitem = TrayCreateMenu("跟随系统启动")
$displayitemYes = TrayCreateItem("跟随系统启动", $settingsitem)
TrayItemSetOnEvent(-1, 'TrayEvent')
$printeritemNo = TrayCreateItem("不随系统启动", $settingsitem)
TrayItemSetOnEvent(-1, 'TrayEvent')
TrayCreateItem("")
$exit = TrayCreateItem("退出")
TrayItemSetOnEvent(-1, 'TrayEvent')
TraySetState()
If RegRead($sRegPath, @ScriptName) <> '' Then
TrayItemSetState($displayitemYes, $TRAY_CHECKED)
Else
TrayItemSetState($printeritemNo, $TRAY_CHECKED)
EndIf
While 1
Sleep(100)
WEnd
Func TrayEvent()
Switch @TRAY_ID
Case $TRAY_EVENT_PRIMARYDOUBLE
GUISetState(@SW_SHOWNORMAL)
Case $displayitemYes
;;;RegWrite($sRegPath, @ScriptName, 'REG_SZ', '"' & @ScriptFullPath & '" /AUTO')
MsgBox(0, '状态:', '跟随系统启动')
Case $printeritemNo
;;;RegDelete($sRegPath, @ScriptName)
MsgBox(0, '状态:', '不随系统启动')
Case $fangwen
;;;Run("rundll32.exe url.dll,FileProtocolHandler http://hi.baidu.com/zizhuxiaoyuan/blog")
Case $guanyu
MsgBox(64, '关于', @CRLF & "你好,我好,大家好!")
Case $exit
Exit
EndSwitch
EndFunc ;==>TrayEvent
Func Form1()
Switch @GUI_CtrlId
Case $GUI_EVENT_CLOSE
Exit
Case $GUI_EVENT_MINIMIZE
GUISetState(@SW_HIDE)
EndSwitch
EndFunc ;==>Form1
Func Form1Close()
Exit
EndFunc ;==>Form1Close
|