Loading
0

[ahk v2][鼠标锁定到窗口内][lockMouse]

程序有autohotkey v2编写,不想自己编译的可以到这里下载编译好的
链接:https://share.weiyun.com/5dLjb8q
密码:pcetg4
简要说明看这里:https://mp.weixin.qq.com/s/WGIulAMY90D5b5WHuUboqw

[/crayon]

}

quit(){
exitapp
}

A_Size(){
if(WinHwnd != WinGetID("A"))
{
ReleaseMouse()
return
}
IsMsg := true
LockMouse()
}

ReleaseMouse(){
NumPut(0,&RECT, 0, "Int")
NumPut(0,&RECT, 4, "Int")
NumPut(A_ScreenWidth,&RECT, 8, "Int")
NumPut(A_ScreenHeight,&RECT, 12, "Int")
DllCall("User32\ClipCursor",Ptr,&RECT)
}

LockMouse(){
static LockFlag:=False
LockFlag := IsMsg?LockFlag:!LockFlag,IsMsg:=False
if !LockFlag
{
ReleaseMouse()
SetTimer "A_Size", "off"
return
}
WinHwnd := WinGetID("A")
DllCall("User32\GetWindowRect",Ptr, WinHwnd, Ptr, &RECT)
DllCall("User32\ClipCursor",Ptr, &RECT)
SetTimer "A_Size", "On"
return
}

OnTop:
WinSetAlwaysOnTop(-1, "A")
return

本文为原创文章,未经同意禁止转载!!