I already have the code to lock the mouse movement within a specific window, but I would like to be more specific and add specific coordinates, for example: (Lock Between(551, 742, x) and Between(235, 494, y) of the "NameWindow"
this is my actual code:
Code: Select all
F21::
LockMouseToWindow("NameWindow")
Return
F24::
LockMouseToWindow()
Return
LockMouseToWindow(llwindowname="")
{
VarSetCapacity(llrectA, 16)
WinGetPos, llX, llY, llWidth, llHeight, %llwindowname%
If (!llWidth AND !llHeight) {
DllCall("ClipCursor")
Return, False
}
Loop, 4 {
DllCall("RtlFillMemory", UInt,&llrectA+0+A_Index-1, UInt,1, UChar,llX >> 8*A_Index-8)
DllCall("RtlFillMemory", UInt,&llrectA+4+A_Index-1, UInt,1, UChar,llY >> 8*A_Index-8)
DllCall("RtlFillMemory", UInt,&llrectA+8+A_Index-1, UInt,1, UChar,(llWidth + llX)>> 8*A_Index-8)
DllCall("RtlFillMemory", UInt,&llrectA+12+A_Index-1, UInt,1, UChar,(llHeight + llY) >> 8*A_Index-8)
}
DllCall("ClipCursor", "UInt", &llrectA)
Return, True
}