算不上什么好东西,抓取拖动窗口的一个测试

算不上什么好东西,抓取拖动窗口的一个测试
#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

 

给TA买糖
共{{data.count}}人
人已赞赏
AHKV1

ahk实现窗口切换辅助工具

2018-1-11 22:02:49

AHKV1

toralf版Windows窗口信息获取(AHK_Window_Info_v1.7)

2018-1-12 9:29:59

0 条回复 A文章作者 M管理员
    暂无讨论,说说你的看法吧
个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索