topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Saturday July 13, 2024, 9:43 pm
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Recent Posts

Pages: [1] 2 3 4 5 6 ... 10next
1
Thanks for welcome. :)

Yes, I wrote the code. If something isn't clear, I can explain it.
2
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 [Select]
  1. #SingleInstance,Force
  2. #NoEnv
  3.  
  4. ; Mouse Rectangle Lock / Release
  5. #c::
  6.         If IsActive = True
  7.         {
  8.                 SetTimer, KeepLock, Off
  9.                 DllCall("ClipCursor", UInt, 0)
  10.                 IsActive = False
  11.         } else {
  12.                 VarSetCapacity(Rect, 16)                        ; Define var size
  13.                 NumPut(0, Rect, 0)                                      ; Left
  14.                 NumPut(0, Rect, 4)                                      ; Top
  15.                 NumPut(1600, Rect, 8)                           ; Right
  16.                 NumPut(1200, Rect, 12)                          ; Bottom
  17.                 DllCall("ClipCursor", UInt, &Rect)
  18.                 SetTimer, KeepLock, 50
  19.                 ActiveOld := WinActive("A")
  20.                 IsActive = True
  21.         }
  22.  
  23. KeepLock:
  24.         Active := WinActive("A")
  25.         If Active <> %ActiveOld%
  26.         {
  27.                 ActiveOld := Active
  28.                 DllCall("ClipCursor", UInt, &Rect)
  29.         }

Bye
Pages: [1] 2 3 4 5 6 ... 10next