2

I know in Windows it is possible to change mouse speed. However, I am wondering is it possible to this dynamically. For example, those moments you just need to move the mouse pointer a little, I find are very difficult due to some RSI problems. If I could hold down a key and then dynamically change the mouse speed it would be a lot easier. Thanks

1 Answer 1

0

Yes, mouse cursor speed is part of WinAPI "SystemParametersInfoA" function.

https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-systemparametersinfoa

Look for these parameters:
SPI_SETMOUSESPEED 0x0071
SPI_GETMOUSESPEED 0x0070

The speed value is 1 to 20.

https://stackoverflow.com/q/2931122/4157407

Here is an example Autohotkey script to change the speed with Capslock:

SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetStoreCapsLockMode, Off
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
#SingleInstance force


setspeed() {
    global speed
    dllcall("SystemParametersInfoA",   uint, 0x71,    uint, 0,    uint, speed,    uint, 0)
}

getspeed() {
    global speed
    dllcall("SystemParametersInfoA",   uint, 0x70,   uint, 0,   uintP, speed,   uint, 0)
}


toggle := 0
speed := 1
toggleSpeed := 3

speedOriginal := 0
dllcall("SystemParametersInfoA",   uint, 0x70,   uint,  0,   uintP, speedOriginal,   uint, 0)
tooltip %speedOriginal%


#if (toggle = 0)
capsLock::
    toggle := 1
    if toggle 
        speed := toggleSpeed
    setspeed()
    tooltip %speed%
return
#if 

capsLock up::
    speed := speedOriginal
    setspeed()
    toggle := 0
    tooltip %speed%
return

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .