I want to forbid mouse cursor from moving to the right of x1800 when notepad is active
is this possible?
so the goal is , to limit the mouse movement x from 0 to 1800, and all y
want to forbid cursor from moving to the right of x1800
Re: want to forbid cursor from moving to the right of x1800
Although there is probably a mouse hook somewhere for this, you could also run a timer that checks the mouse position and then moves the mouse. Example.
Re: want to forbid cursor from moving to the right of x1800
Yep. There exists a clipcursor function.
https://www.autohotkey.com/boards/viewtopic.php?p=287979#p287979
https://www.autohotkey.com/boards/viewtopic.php?p=287979#p287979
Code: Select all
Esc:: ExitApp
f1:: ;on
ClipCursor( True, 100, 100, 200, 200)
Return
f2:: ;off
ClipCursor( False)
return
ClipCursor( Confine:=True, x1:=0 , y1:=0, x2:=1, y2:=1 ) {
pData := DllCall("GlobalAlloc", "uint", 0x0, "uptr", 16, "ptr")
NumPut(x1, pData+0, "int")
NumPut(y1, pData+4, "int")
NumPut(x2, pData+8, "int")
NumPut(y2, pData+12, "int")
value := Confine ? DllCall( "ClipCursor", "ptr", pData ) : DllCall( "ClipCursor" )
DllCall("GlobalFree", "ptr",pData)
return value
}