【问题标题】:Programmatically change cursor speed in windows以编程方式更改窗口中的光标速度
【发布时间】:2022-01-20 04:41:10
【问题描述】:

由于在SuperUser 上得到满意的答案非常困难,我想改写this question 并问:

有没有办法以编程方式检测鼠标插入 USB 端口,并更改 Windows 中的光标速度(可能通过 API)?

我想使用 C#,但我愿意接受任何可以在 Windows 7 机器上运行的语言。

【问题讨论】:

    标签: c# windows-7 mouse-cursor


    【解决方案1】:

    我不知道检测,但您可以使用 P/Invoke 到 SystemParametersInfo api 使用

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

    uiAction 为 (SPI_SETMOUSESPEED) = 0x0071

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2010-10-06
    • 1970-01-01
    • 1970-01-01
    • 2010-09-26
    • 1970-01-01
    • 1970-01-01
    • 2013-09-09
    相关资源
    最近更新 更多