加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

(C)带SPI_SetMouse的SystemParametersInfo似乎不会改变光标速度

发布时间:2020-12-16 07:29:32 所属栏目:百科 来源:网络整理
导读:我基本上直接从 MSDN documentation复制了以下代码: #include windows.h#include stdio.h#pragma comment(lib,"user32.lib")int main(){ BOOL fResult; int aMouseInfo[3]; // array for mouse information // Get the current mouse speed. fResult = Syst
我基本上直接从 MSDN documentation复制了以下代码:

#include <windows.h>
#include <stdio.h>
#pragma comment(lib,"user32.lib")

int main()
{
   BOOL fResult;
   int aMouseInfo[3];       // array for mouse information

   // Get the current mouse speed. 

   fResult = SystemParametersInfo(
      SPI_GETMOUSE,// get mouse information 
      0,// not used 
      &aMouseInfo,// holds mouse information
      0);             // not used 

   // Double it. 

   if( fResult )
   {
      aMouseInfo[2] =  1; // 2 * aMouseInfo[2]; 
      // 1 should be a very noticeable change: slowing the cursor way down
      // Change the mouse speed to the new value. 

      SystemParametersInfo(
         SPI_SETMOUSE,// set mouse information
         0,// not used 
         aMouseInfo,// mouse information 
         SPIF_SENDCHANGE);  // update win.ini 
   }
   return 0;
}

然而,当我运行它时,似乎没有任何事情发生.鼠标速度应该改变,但事实并非如此.

Windows Vista Home x32(ouch)
Dev-C便携式

解决方法

这里,aMouseInfo [2]指的是Enhance Mouse Precision字段.
如果aMouseInfo [2]设置为TRUE(或指定除0以外的任何编号),则“增强鼠标精度”字段为SET,如果为FALSE(或指定为0),则“增强鼠标精度”字段为UNSET.

要获取和设置Mousespeed,您可以使用SPI_GETMOUSESPEED和SPI_SETMOUSESPEED resp.

要使用SPI_GETMOUSESPEED和SPI_SETMOUSESPEED,请参阅post.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读