SystemParametersInfoA with SPI_GETMOUSE returns 0's

本秂侑毒 提交于 2020-06-01 07:36:05

问题


Go to the answer of the question

I'm trying to get my mouse speed, but when I call the function SystemParametersInfoA with parameter SPI_GETMOUSE it sets the target array to {0,0,0} which I think its not supposed to happen.

Example code:

int IntArr[3];
SystemParametersInfoA(SPI_GETMOUSE, 0, &IntArr, 0);

I tried changing my mouse sensitivity (from the control panel) but that didn't work either.

Does this function is supposed to return those zeros or thats my fault?


回答1:


The documentation says:

Retrieves the two mouse threshold values and the mouse acceleration.

At first I did tought that these two mouse threshold values were related to my mouse cursor sensitivty.

After a deeper search in the docs for mouse_event, I found out that in the remarks section it says:

The system applies two tests to the specified relative mouse motion when applying acceleration. If the specified distance along either the x or y axis is greater than the first mouse threshold value, and the mouse acceleration level is not zero, the operating system doubles the distance. If the specified distance along either the x- or y-axis is greater than the second mouse threshold value, and the mouse acceleration level is equal to two, the operating system doubles the distance that resulted from applying the first threshold test. It is thus possible for the operating system to multiply relatively-specified mouse motion along the x- or y-axis by up to four times.

Which basically means that these 3 values that I got in the destination array IntArr wasn't anything to do with sensitivity, but rather these 2 mouse threshold values and the "Enhance pointer precission" which was either 0 or 1 indicating it turned on or off, mine was disabled thats why I got all zeros.

In order to get the mouse sensitivity you have to use SystemParametersInfoA function with the SPI_GETMOUSESPEED parameter as uiAction instead.



来源:https://stackoverflow.com/questions/60233180/systemparametersinfoa-with-spi-getmouse-returns-0s

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!