I'm trying to change mouse sensitivity using SystemParametersInfo but it doesn't work, below code is returning 0 in result but there GetLastError is also returning 0. Am I setting the Uint32 Pointer wrong or this just doesn't work?
Microsoft Docs says
Sets the current mouse speed. The pvParam parameter is an integer between 1 (slowest) and 20 (fastest). A value of 10 is the default. This value is typically set using the mouse control panel application.
CODE:
const int SPIF_UPDATEINIFILE = 0x01;
const int SPIF_SENDCHANGE = 0x02;
final pSpeed = calloc<ffi.Uint32>()..value = 16;
final result =
SystemParametersInfo(SPI_SETMOUSESPEED, 0, pSpeed, SPIF_UPDATEINIFILE | SPIF_SENDCHANGE);
if (result != 0) {
print('Mouse speed set successfully to $speed');
} else {
print(
'Failed to set mouse speed. Error: ${WindowsException(HRESULT_FROM_WIN32(GetLastError()))}');
}
calloc.free(pSpeed);
OUTPUT:
flutter: RESULT: 0
flutter: Failed to set mouse speed. Error: Error 0x00000000: The operation completed successfully.
I'm trying to change mouse sensitivity using SystemParametersInfo but it doesn't work, below code is returning 0 in result but there GetLastError is also returning 0. Am I setting the Uint32 Pointer wrong or this just doesn't work?
Microsoft Docs says
Sets the current mouse speed. The pvParam parameter is an integer between 1 (slowest) and 20 (fastest). A value of 10 is the default. This value is typically set using the mouse control panel application.
CODE:
OUTPUT: