Hey, noob here.
This is ClipCursor(); it's for locking the mouse along certain lines.
I've been using it for horizontal axes for a long time and it's very useful:
I thought I could guess my way through adapting it for a vertical axis,
but it turns out I can't, after 30 minutes of fiddling, despite the fact it's easy.
Any help?
Thanks!
This is ClipCursor(); it's for locking the mouse along certain lines.
CODE:
ClipCursor(confine:=true, x1:=0, y1:=0, x2:=1, y2:=1) {
static rect := Buffer(16)
if confine {
NumPut("UInt", x1, "UInt", y1, "UInt", x2, "UInt", y2, rect)
return DllCall("ClipCursor", "Ptr", rect)
} else {
return DllCall("ClipCursor", "Ptr", 0)
}
}
I've been using it for horizontal axes for a long time and it's very useful:
CODE:
; VLC - lock cursor to navigation bar
;----------------------------------------------------------------------------------
#HotIf WinActive(". ahk_exe vlc.exe")
#:: {
WinGetPos(&X,&Y,&W,&H,"A")
MouseGetPos(&mouseX,&mouseY)
yCoord:=Y+H-50 ; nav bar
ClipCursor(1, 0, yCoord, A_ScreenWidth, yCoord+1)
KeyWait("#")
ClipCursor(0)
MouseGetPos(&mouseX2,&mouseY2)
MouseMove(mouseX2,mouseY,0)
}
#HotIf
;----------------------------------------------------------------------------------
I thought I could guess my way through adapting it for a vertical axis,
but it turns out I can't, after 30 minutes of fiddling, despite the fact it's easy.
Any help?
Thanks!
Statistics: Posted by robinson — Today, 12:20