DonationCoder.com Software > Post New Requests Here
IDEA: Confine Mouse to Specific Monitor in Multi-monitor setup
mouser:
Nice work snouffelaire, and welcome to the site :up:
lanux128:
cool! this is quite an useful program. thanks snouffelaire. :)
BaNDiToS:
This code is what probably everybody in this thread is looking for and its a pure AHK solution without .NET-Frameworks. Just start and hit Win+C to enable / disable.
--- Code: AutoIt ---#SingleInstance,Force#NoEnv ; Mouse Rectangle Lock / Release#c:: If IsActive = True { SetTimer, KeepLock, Off DllCall("ClipCursor", UInt, 0) IsActive = False } else { VarSetCapacity(Rect, 16) ; Define var size NumPut(0, Rect, 0) ; Left NumPut(0, Rect, 4) ; Top NumPut(1600, Rect, 8) ; Right NumPut(1200, Rect, 12) ; Bottom DllCall("ClipCursor", UInt, &Rect) SetTimer, KeepLock, 50 ActiveOld := WinActive("A") IsActive = True }Return KeepLock: Active := WinActive("A") If Active <> %ActiveOld% { ActiveOld := Active DllCall("ClipCursor", UInt, &Rect) }Return
Bye
mouser:
Welcome to the site BaNDiToS :Thmbsup:
Are we right in assuming you wrote this code?
BaNDiToS:
Thanks for welcome. :)
Yes, I wrote the code. If something isn't clear, I can explain it.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version