Messages - BaNDiToS [ switch to compact view ]

Pages: [1]
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]
Go to full version