开发者

Programmatically change cursor speed in windows

开发者 https://www.devze.com 2022-12-25 11:39 出处:网络
Since getting a satisfactory answer on SuperUser is very difficult, I want to rephrase this question and ask:

Since getting a satisfactory answer on SuperUser is very difficult, I want to rephrase this question and ask:

Is there any way to programmatically detect a开发者_StackOverflow中文版 mouse was plugged in the usb port, and change the cursor speed in windows (perhaps through an API)?

I'd like to use C#, but I'm open to any language that can run on a windows 7 machine.


I don't know about the detection but you can use P/Invoke to the SystemParametersInfo api using

[DllImport("user32.dll", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
static extern bool SystemParametersInfo(SPI uiAction, uint uiParam, String pvParam, SPIF fWinIni);

with the uiAction as (SPI_SETMOUSESPEED) = 0x0071

0

精彩评论

暂无评论...
验证码 换一张
取 消