#NoTrayIcon
#include <GuiConstantsEx.au3>
#include "ModernMenuRaw.au3"
#Include <GuiImageList.au3>
$skins=@SystemDir & "\seafile\QQ2009.she" ;皮肤
$Dll = DllOpen(@SystemDir & "\seafile\Skin.dll")
DllCall($Dll, "int", "SkinH_AttachEx", "str", $skins, "str", "mhgd")
DllCall($Dll, "int", "SkinH_SetAero", "int",1) ;1玻璃效果$Dll = DllOpen(@SystemDir & "\seafile\Skin.dll")
DllCall($Dll, "int", "SkinH_AttachEx", "str", $skins, "str", "mhgd")
DllCall($Dll, "int", "SkinH_SetAero", "int",1) ;1玻璃效果
Opt("GUIOnEventMode", 1) ;GUI事件响应模式
Opt("GUIEventOptions",1) ;修改特殊的 GUI 函数的返回值类型 1=立即通知
;Opt("WinTitleMatchMode",2);标题的任意子串皆可匹配
Opt("GUICloseOnESC",0);在按下 ESC 时不退出
Global Const $TRAY_EVENT_PRIMARYDOUBLE = -13
Global Const $POLICY_GET_PRIVATE_INFORMATION = 4 ;获取宽带帐号及密码
If Not IsDeclared("ERROR_INVALID_SID") Then Global Const $ERROR_INVALID_SID = 1337
Global Const $tagLSAUNICODE = "ushort Length;ushort MaxLength;ptr Wbuffer"
Global Const $tagLSAOBJATTR = "ulong Length;hWnd RootDir;ptr objName;ulong Attr;ptr SecurDescr;ptr SecurQuality"
Global $TranValue, $flag ;谷歌英汉互译
$flag = "en%7Czh-CN"
$HwndC = WinGetHandle("Program Manager");桌面也是一个窗口,标题为Program Manager
$g_szVersion = "拾零装机工具箱" ;不重复运行本程序
If WinExists($g_szVersion) Then ;检测是否有同一程序运行
MsgBox(48, "提示 - 拾零装机工具箱", "温馨提示:[拾零装机工具箱]已在运行了,请勿重复运行! ",5,$HwndC)
Exit ; 此脚本已经运行了
EndIf
$Gui_w = 330
$gui_h = 390
$hGUI = GUICreate("拾零装机工具箱", $Gui_w, $gui_h, @DesktopWidth - $Gui_w, Default, Default, Default)
$guiRect = _WinAPI_GetWindowRect($hGUI)
GUISetFont(9.7, 0, 0, "Tahoma") ;窗口默认字体
;--------------------工具栏------------
Global $hTray = ControlGetHandle('[CLASS:Shell_TrayWnd]', '', 'TrayNotifyWnd1')
Global $trayRect = _WinAPI_GetWindowRect($hTray)
;=============================GUI界面-第一分页=============================
$Tab1 = GUICtrlCreateTabItem("系统工具")
$hGUI001 = GUICtrlCreateRadio("Word Wrong 修复", 30, 80, 130, 25, 0)
;------------------------第二分页-------------------------
$Tab2 = GUICtrlCreateTabItem("常用软件")
$Button21 = GUICtrlCreateRadio("电脑时间校准工具", 30, 80, 130, 25, 0)
GUISetOnEvent($GUI_EVENT_MINIMIZE, "TrayClick")
GUISetState() ;显示GUI界面
;=================== 托盘菜单添加图标 ===========================
$nTrayIcon1 = _TrayIconCreate(" 拾零装机工具箱 ", "", 0)
_TrayIconSetClick(-1, 16)
$bUseAdvTrayMenu = False;菜单样式(可取值 TRUE 和 False)
$nTrayMenu1 = _TrayCreateContextMenu() ; 创建托盘上下文菜单,即右键点击托盘图标显示的菜单
$tc = _TrayCreateMenu("在线小贴士")
_TrayItemSetIcon(-1, @SystemDir & "\seafile\Sealin.DLL", -11)
$tc4 = _TrayCreateItem("网速测试", $tc)
_TrayItemSetIcon(-1, @SystemDir & "\seafile\Sealin.DLL", -25)
$f2 = _TrayCreateItem("隐藏窗口")
_TrayItemSetIcon(-1, @SystemDir & "\seafile\Sealin.DLL", -40)
GUICtrlSetOnEvent(-1, "TrayClick")
_TrayCreateItem("") ;文本为空时添加分割线
$exitom =_TrayCreateItem("退出程序")
_TrayItemSetIcon(-1, @SystemDir & "\seafile\Sealin.DLL", -1)
GUICtrlSetOnEvent(-1, "_Quit")
_TrayIconSetState();显示托盘
While 1
Sleep(1000)
WEnd
Func _Quit() ;退出时删除皮肤调用文件
FileDelete(@ProgramFilesDir & "\Sealin\*.*")
_TrayIconDelete($nTrayIcon1) ;退出时删除托盘图标
WinMove("", "", @DesktopWidth + 10, Default, Default, Default, 2);退出时特效显示
;DirRemove(@AppDataDir&"\skin",1)
Exit
EndFunc
Func TrayClick() ;双击托盘隐/显窗口
$winstate = WinGetState($hGUI)
If $winstate = 7 Or $winstate = 15 Then
GUISetState(@SW_HIDE, $hGUI)
_GUICtrlODMenuItemSetText($f2, "显示窗口")
_WinAPI_DrawAnimatedRects($hGUI, $guiRect, $trayRect) ;最小化特效
Else
_GUICtrlODMenuItemSetText($f2, "隐藏窗口")
_WinAPI_DrawAnimatedRects($hGUI, $trayRect, $guiRect)
GUISetState(@SW_SHOW, $hGUI)
EndIf
EndFunc
Func _WinAPI_DrawAnimatedRects($hWnd, $tRectFrom, $tRectTo)
Local $Ret = DllCall('user32.dll', 'int', 'DrawAnimatedRects', 'hwnd', $hWnd, 'int', 3, 'ptr', DllStructGetPtr($tRectFrom), 'ptr', DllStructGetPtr($tRectTo))
If (@error) Or ($Ret[0] = 0) Then
Return SetError(1, 0, 0)
EndIf
Return 1
EndFunc ;==>_WinAPI_DrawAnimatedRects