Advertisement
eggbrow

Untitled

Jan 14th, 2019
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. #Include <_Struct>
  2. ~Shift::MouseKeys(0) ;Disable MOUSEKEYS
  3. ~Shift UP::MouseKeys(1) ;Enable MOUSEKEYS
  4. ^!Space::MsgBox % "MouseKeys are " (MouseKeys(-1) ? "On" : "Off")
  5.  
  6. Numpad2::MsgBox
  7.  
  8. MouseKeys(OnOff=0){
  9. static MOUSEKEYS:="DWORD cbSize,DWORD dwFlags,DWORD iMaxSpeed,DWORD iTimeToMaxSpeed,DWORD iCtrlSpeed,DWORD dwReserved1,DWORD dwReserved2"
  10. ,SPI_GETMOUSEKEYS:=0x0036,SPI_SETMOUSEKEYS:=0x0037
  11. MK:=Struct(MOUSEKEYS),MK.cbSize:=Struct(MK)
  12. DllCall("SystemParametersInfo", UInt, SPI_GETMOUSEKEYS, "UInt", MK.cbSize, "UInt", MK[""], "UInt", 0)
  13. If OnOff=-1
  14. MK.dwFlags:=MK.dwFlags+((MK.dwFlags & 1)?-1:1)
  15. else if OnOff
  16. MK.dwFlags:=MK.dwFlags+((MK.dwFlags & 1)?0:1)
  17. else
  18. MK.dwFlags:=MK.dwFlags+((MK.dwFlags & 1)?-1:0)
  19. Loop 2
  20. DllCall("SystemParametersInfo", UInt, Mod(A_Index,2)?SPI_SETMOUSEKEYS:SPI_GETMOUSEKEYS, "UInt", MK.cbSize, "UInt", MK[""], "UInt", 0)
  21. Return (MK.dwFlags & 1)
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement