Programmatically change cursor speed in windows

僤鯓⒐⒋嵵緔 提交于 2019-12-02 15:01:03

问题


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 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.


回答1:


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



来源:https://stackoverflow.com/questions/2553314/programmatically-change-cursor-speed-in-windows

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