Tag: 鼠标指针

切换增强指针精度

我们基本上是在创建一个控制面板小程序。 我们需要在鼠标属性中切换“增强指针精度”。 为此,我们需要使用SPI_GETMOUSE调用SystemParametersInfo 。 它有一个由3个元素组成的数组作为其第三个参数。 我是PInvoke的新手,我尝试了许多签名,但到目前为止还没有运气。 这是我为签名尝试的内容: [DllImport(“user32.dll”, SetLastError = true)] [return: MarshalAs(UnmanagedType.Bool)] static extern bool SystemParametersInfo(uint uiAction, uint uiParam, [MarshalAs(UnmanagedType.LPArray)] ref long[] vparam, SPIF fWinIni); static extern bool SystemParametersInfo(uint uiAction, uint uiParam, ref long[] vparam, SPIF fWinIni); 以上都没有为我工作,这是我得到的例外: System.AccessViolationException :尝试读取或写入受保护的内存。 这通常表明其他内存已损坏。 在搜索时我想出了这个在VB中。 解决方案:感谢GWLlosa的回答 ,我想出了解决方案: [DllImport(“user32.dll”, EntryPoint = “SystemParametersInfo”, SetLastError = true)] public static extern […]

以编程方式更改窗口中的光标速度

由于在SuperUser上获得满意的答案非常困难,我想重新解释这个问题并问: 有没有办法以编程方式检测插入usb端口的鼠标,并在windows中更改光标速度(可能通过API)? 我想使用C#,但我对任何可以在Windows 7机器上运行的语言都开放。