(C ++) SystemParametersInfo with SPI_SetMouse doesn't seem to change cursor speed

I basically copied the following code directly from the MSDN documentation :

#include <windows.h> #include <stdio.h> #pragma comment(lib, "user32.lib") int main() { BOOL fResult; int aMouseInfo[3]; // array for mouse information // Get the current mouse speed. fResult = SystemParametersInfo( SPI_GETMOUSE, // get mouse information 0, // not used &aMouseInfo, // holds mouse information 0); // not used // Double it. if( fResult ) { aMouseInfo[2] = 1; // 2 * aMouseInfo[2]; // 1 should be a very noticeable change: slowing the cursor way down // Change the mouse speed to the new value. SystemParametersInfo( SPI_SETMOUSE, // set mouse information 0, // not used aMouseInfo, // mouse information SPIF_SENDCHANGE); // update win.ini } return 0; } 

But when I run it, nothing happens. The mouse speed should change, but it is not.

Windows Vista Home x32 (ouch) Dev-C ++ Portable

+4
source share
1 answer

Here aMouseInfo [2] refers to the field of improving mouse accuracy . if the parameter aMouseInfo [2] is set to TRUE (or a value other than 0 is assigned), then Improve the mouse accuracy field - SET, and if FALSE (or 0), then the Enhance Mouse Precision field is UNSET.

To get and configure Mousespeed, you can use SPI_GETMOUSESPEED and SPI_SETMOUSESPEED, respectively.

To use SPI_GETMOUSESPEED and SPI_SETMOUSESPEED, see the post.

+2
source

Source: https://habr.com/ru/post/1403182/


All Articles