算不上什么好东西,抓取拖动窗口的一个测试
#SingleInstance FORCE #NoEnv CoordMode, ToolTip, Screen CoordMode, Mouse, Screen SetTimer winMonitor, 0 global CustomColor:=0xFF0000, bord:=5, move_WinID, GEvents, IsRight, step:=10, showTip:=1 Gui, +hwndmove_WinID +AlwaysOnTop -Resize +LastFound Gui, Color, % CustomColor Gui, Add, Text, x0 y0 h%A_ScreenHeight% w%A_ScreenWidth% gmoveWin WinSet, Transparent, 150 Gui, -Caption Gui, Show, H240 W320 Return moveWin: PostMessage, 0xA1, 2, , , Ahk_Id %move_WinID% gosub winMonitor Return GuiEscape: GuiClose: ExitApp GuiContextMenu(GuiHwnd, CtrlHwnd, EventInfo, IsRightClick, X, Y) { if !IsRightClick return GEvents := "RButton" } winMonitor: if !(UniqueID := WinActive("Ahk_Id " move_WinID)) { ToolTip return } infotip: WinGetPos, X, Y, Width, Height, Ahk_Id %move_WinID% MouseGetPos, OutputVarX, OutputVarY GEvents := (A_GuiEvent ? A_GuiEvent : GEvents) if (OutputVarX>=X && OutputVarX<=(X+Width) && OutputVarY>=Y && OutputVarY<=(Y+Height)) { if showTip ToolTip, % "" ;move_WinID "`n" OutputVarX "`t" OutputVarY . "`n鼠标:`t" GEvents . "`n调整步长:`t" step , OutputVarX+16, OutputVarY+16 else ToolTip OnWin := 1 } else { OnWin := 0 ToolTip } return ~WheelUp:: if !(UniqueID := WinActive("Ahk_Id " move_WinID)) || !OnWin { ToolTip return } if GetKeyState("LButton") { if step<50 { if step >=10 step+=5 else step+=1 } gosub infotip } else if GetKeyState("RButton") { gosub infotip WinMove, A, , , , % Width + step gosub infotip } else { gosub infotip WinMove, A, , , , , % Height + step gosub infotip } return ~MButton:: if !(UniqueID := WinActive("Ahk_Id " move_WinID)) || !OnWin { return } showTip:=!showTip return ~WheelDown:: if !(UniqueID := WinActive("Ahk_Id " move_WinID)) || !OnWin { ToolTip return } if GetKeyState("LButton") { if step>=15 step-=5 else if step>0 step-=1 gosub infotip } else if GetKeyState("RButton") { gosub infotip WinMove, A, , , , % Width - step gosub infotip } else { gosub infotip WinMove, A, , , , ,% Height - step gosub infotip } return