#Region
#AutoIt3Wrapper_Icon=
#AutoIt3Wrapper_OutFile=
#AutoIt3Wrapper_Res_LegalCopyright=
#EndRegion
#RequireAdmin
#NoTrayIcon
#include <IE.au3>
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <GUIConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
Opt("MouseCoordMode",0);相对激活窗口的坐标
Opt("WinTitleMatchMode",2);标题的任意子串皆可匹配
Opt("GUICloseOnESC",0);在按下 ESC 时不退出
Opt("CaretCoordMode", 1);设置成绝对坐标
Opt("GUIOnEventMode", 1);启用ONEVENT函数
Opt("GUIResizeMode", 802);控件位置不变
OnAutoItExitRegister("quit")
#Region ### START Koda GUI section ### Form1=
$Form1 = GUICreate("常用工具箱",300, 600, -1,-1,BitOR($WS_SYSMENU,$WS_CAPTION,$WS_POPUP,$WS_POPUPWINDOW,$WS_BORDER,$WS_CLIPSIBLINGS))
$group2=GUICtrlCreateGroup("扩展功能",0,300,300,300)
$gdgn=GUICtrlCreateButton("收缩↑",5,270,50,25,0x01)
$tqyb=GUICtrlCreateCheckbox("天气预报",230,270,65,25)
$shousuo = _GUICtrlStatusBar_Create($Form1)
$group1 = GUICtrlCreateGroup("常用功能", 0, 0, 300, 300)
GUISetState(@SW_SHOW)
$XY=ControlGetPos($Form1,"常用工具箱",$group1)
$X0=$XY[2]
$Y0=$XY[3]
$Hide="0"
$mouseON=False
GUIRegisterMsg($WM_SIZE, "WM_SIZE")
GUISetOnEvent($tqyb,"tqyb")
GUISetOnEvent($gui_event_close,"quit")
#EndRegion ### END Koda GUI section ###
#Region ### START Koda GUI section ### Form2=
$form2=GUICreate("天气预报",265,200,-1,-1,$WS_POPUP,$WS_EX_TOOLWINDOW)
$oIE = _IECreateEmbedded()
GUICtrlCreateObj($oIE, 0, 0, 265, 200)
_IENavigate($oIE,"http://www.soso.com/tb.q")
GUICtrlSetOnEvent($tqyb,"tqyb")
GUISetState(@SW_DISABLE,$form2)
AdlibRegister("_Resize_and_Other",50)
#EndRegion ### END Koda GUI section ###
While 1
$nmsg=GUIGetMsg()
Switch $nmsg
Case $gdgn
If GUICtrlRead($gdgn)="收缩↑" Then
WinMove($Form1,"",Default,Default,Default,300)
GUICtrlSetData($gdgn,"更多↓")
ElseIf GUICtrlRead($gdgn)="更多↓" Then
WinMove($Form1,"",Default,Default,Default,600)
GUICtrlSetData($gdgn,"收缩↑")
EndIf
EndSwitch
WEnd
While 2
Sleep (100)
WEnd
Func WM_SIZE($hWnd, $Msg, $wParam, $lParam)
_GUICtrlStatusBar_Resize($shousuo)
Return $GUI_RUNDEFMSG
EndFunc
Func tqyb()
Local $Form1Pos=WinGetPos($Form1)
If GUICtrlRead($tqyb)=$GUI_CHECKED Then
WinMove($form2,"天气预报",$Form1Pos[0]+$Form1Pos[2],$Form1Pos[1])
GUISetState(@SW_SHOW,$form2)
Else
GUISetState(@SW_HIDE,$form2)
EndIf
EndFunc
Func _Resize_and_Other()
_MouseOutGui_and_WriteFile()
Local $Xmax=@DesktopWidth
Local $XY=ControlGetPos($Form1,"",$group1)
Local $Wxy=WinGetPos($Form1)
Local $K=$Wxy[3]/500
Local $Iy=500
Local $Ix=Int($Wxy[2]/$K)
Local $Xn
if $XY[2]<>$X0 Or $XY[3]<>$Y0 Then
$X0=$XY[2]
$Y0=$XY[3]
ControlMove($Form1,"",$group1,0,0,$X0,$Y0)
EndIf
If $Wxy[0]<=20 And $Hide="0" And $mouseON=False Then
For $i=1 To $Ix
If $Wxy[0]<0 Then
$Xn=$Wxy[0]-Int($Wxy[2]/$Ix*$I)
Else
$Xn=0-Int($Wxy[2]/$Ix*$I)
EndIf
WinMove($Form1,"",$Xn,$Wxy[1])
If $Xn<=-$Wxy[2] Then ExitLoop
Next
$Hide="LEFT"
WinSetOnTop($Form1,"",1)
EndIf
If $Xmax-($Wxy[0]+$Wxy[2])<=20 And $Hide="0" And $mouseON=False Then
For $i=1 To $Ix
If $Xmax-($Wxy[0]+$Wxy[2])<=0 Then
$Xn=$Wxy[0]+Int($Wxy[2]/$Ix*$I)
Else
$Xn=$Xmax-$Wxy[2]+Int($Wxy[2]/$Ix*$I)
EndIf
WinMove($Form1,"",$Xn,$Wxy[1])
If $Xn>=$Xmax+1 Then ExitLoop
Next
$Hide="RIGHT"
WinSetOnTop($Form1,"",1)
EndIf
If $Wxy[1]<=20 And $Hide="0" And $mouseON=False Then
For $i=1 To $Iy
If $Wxy[1]>0 Then
$Xn=0-Int($Wxy[3]/$Iy*$I)
Else
$Xn=$Wxy[1]-Int($Wxy[3]/$Iy*$I)
EndIf
WinMove($Form1,"",$Wxy[0],$Xn)
If $Xn+$Wxy[3]<=0 then ExitLoop
Next
$Hide="UP"
WinSetOnTop($Form1,"",1)
EndIf
Local $MouseXY=MouseGetPos()
If $MouseXY[1]<$Wxy[1]+$Wxy[3] And $MouseXY[1]>$Wxy[1] And $MouseXY[0]=0 And $Hide="LEFT" Then
For $i=1 To $Ix
Local $Xn=int($Wxy[2]/$Ix*$I)-$Wxy[2]
WinMove($Form1,"",$Xn,$Wxy[1])
Next
$Hide="0"
WinSetOnTop($Form1,"",0)
EndIf
If $MouseXY[1]<$Wxy[1]+$Wxy[3] And $MouseXY[1]>$Wxy[1] And $MouseXY[0]=$Xmax-1 And $Hide="RIGHT" Then
For $i=1 To $Ix
Local $Xn=$Xmax-int($Wxy[2]/$Ix*$I)
WinMove($Form1,"",$Xn,$Wxy[1])
Next
$Hide="0"
WinSetOnTop($Form1,"",0)
EndIf
If $MouseXY[0]<$Wxy[0]+$Wxy[2] And $MouseXY[0]>$Wxy[0] And $MouseXY[1]=0 And $Hide="UP" Then
For $i=1 To $Iy
Local $Xn=-$Wxy[3]+int($Wxy[3]/$Iy*$I)
WinMove($Form1,"",$Wxy[0],$Xn)
Next
$Hide="0"
WinSetOnTop($Form1,"",0)
EndIf
EndFunc
Func _MouseOutGui_and_WriteFile()
Local $Wxy=WinGetPos($Form1)
Local $MouseXY=MouseGetPos()
If $MouseXY[0]<=$Wxy[0]+$Wxy[2] And $MouseXY[0]>=$Wxy[0] And $MouseXY[1]<=$Wxy[1]+$Wxy[3] And $MouseXY[1]>=$Wxy[1] Then
$mouseON=True
Else
$mouseON=False
EndIf
EndFunc
Func quit()
Exit
EndFunc