• <tfoot id='N6r1O'></tfoot>

    <small id='N6r1O'></small><noframes id='N6r1O'>

    <legend id='N6r1O'><style id='N6r1O'><dir id='N6r1O'><q id='N6r1O'></q></dir></style></legend>
  • <i id='N6r1O'><tr id='N6r1O'><dt id='N6r1O'><q id='N6r1O'><span id='N6r1O'><b id='N6r1O'><form id='N6r1O'><ins id='N6r1O'></ins><ul id='N6r1O'></ul><sub id='N6r1O'></sub></form><legend id='N6r1O'></legend><bdo id='N6r1O'><pre id='N6r1O'><center id='N6r1O'></center></pre></bdo></b><th id='N6r1O'></th></span></q></dt></tr></i><div id='N6r1O'><tfoot id='N6r1O'></tfoot><dl id='N6r1O'><fieldset id='N6r1O'></fieldset></dl></div>
    • <bdo id='N6r1O'></bdo><ul id='N6r1O'></ul>

      1. 如何配置鼠标以编程方式提高指针精度

        时间:2023-10-17
            • <tfoot id='KceSO'></tfoot>

            • <legend id='KceSO'><style id='KceSO'><dir id='KceSO'><q id='KceSO'></q></dir></style></legend>
                  <bdo id='KceSO'></bdo><ul id='KceSO'></ul>

                  <small id='KceSO'></small><noframes id='KceSO'>

                    <tbody id='KceSO'></tbody>
                  <i id='KceSO'><tr id='KceSO'><dt id='KceSO'><q id='KceSO'><span id='KceSO'><b id='KceSO'><form id='KceSO'><ins id='KceSO'></ins><ul id='KceSO'></ul><sub id='KceSO'></sub></form><legend id='KceSO'></legend><bdo id='KceSO'><pre id='KceSO'><center id='KceSO'></center></pre></bdo></b><th id='KceSO'></th></span></q></dt></tr></i><div id='KceSO'><tfoot id='KceSO'></tfoot><dl id='KceSO'><fieldset id='KceSO'></fieldset></dl></div>
                  本文介绍了如何配置鼠标以编程方式提高指针精度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  如何在 C++ 中以编程方式配置鼠标以提高指针精度?我知道有一些有用的命令,比如 SystemParametersInfo,为了速度,......

                  int x = 15;

                  <块引用>

                  SystemParametersInfo(SPI_SETMOUSESPEED, NULL, reinterpret_cast(x),SPIF_UPDATEINIFILE | SPIF_SENDWININICHANGE);

                  ...但我找不到增强精度----

                  解决方案

                  根据 SystemParametersInfo 函数和 SPI_SETMOUSE 的noreferrer">文档:

                  <块引用>

                  设置两个鼠标阈值和鼠标加速度.pvParam 参数必须指向指定这些值的三个整数数组.有关详细信息,请参阅 mouse_event.

                  因此您需要一个包含 3 个值的数组,并在调用 SystemParametersInfo 时指定一个指向该数组的指针作为 pvParam 参数.

                  因为您只关心改变加速度(最后一个值),所以您可能希望保留前两个的当前值,即鼠标阈值.通过调用带有 SPI_GETMOUSE 标志的 SystemParametersInfo 来获取这些值,然后修改最后一个(加速),然后再次调用 SystemParametersInfo,这次使用 SPI_SETMOUSE 标志.

                  示例代码(没有推荐的错误检查):

                  //通过调用 SystemParametersInfo 函数打开/关闭鼠标加速.//当mouseAccel为TRUE时,开启鼠标加速;FALSE 表示关闭.void SetMouseAcceleration(BOOL mouseAccel){int mouseParams[3];//获取当前值.SystemParametersInfo(SPI_GETMOUSE, 0, mouseParams, 0);//按照指示修改加速度值.mouseParams[2] = mouseAccel;//更新系统设置.SystemParametersInfo(SPI_SETMOUSE, 0, mouseParams, SPIF_SENDCHANGE);}

                  你可能已经知道这一点,但是有太多行为不端的应用程序,我更不用说以防万一了.如果您在应用程序中执行此操作,请务必保存原始值,以便在应用程序关闭时可以恢复它!这只是修改系统范围设置时的基本礼节.

                  How to configure mouse enhance pointer precision programmatically in C++? I know that have some useful commands like SystemParametersInfo, for speed, ...

                  int x = 15;
                  

                  SystemParametersInfo(SPI_SETMOUSESPEED, NULL, reinterpret_cast(x),SPIF_UPDATEINIFILE | SPIF_SENDWININICHANGE );

                  ... but I cannot find enhance precision----

                  解决方案

                  According to the documentation for the SystemParametersInfo function and SPI_SETMOUSE:

                  Sets the two mouse threshold values and the mouse acceleration. The pvParam parameter must point to an array of three integers that specifies these values. See mouse_event for further information.

                  So you need an array containing 3 values, and you specify a pointer to that array as the pvParam parameter when calling SystemParametersInfo.

                  Since all you care about is changing the acceleration (the last value), you probably want to retain the current values for the first two, the mouse threshold values. Do that by calling SystemParametersInfo with the SPI_GETMOUSE flag to obtain those values, then modifying the last one (the acceleration), and then calling SystemParametersInfo again, this time with the SPI_SETMOUSE flag.

                  Sample code (without recommended error checking):

                  // Turns mouse acceleration on/off by calling the SystemParametersInfo function.
                  // When mouseAccel is TRUE, mouse acceleration is turned on; FALSE for off.
                  void SetMouseAcceleration(BOOL mouseAccel)
                  {
                      int mouseParams[3];
                  
                      // Get the current values.
                      SystemParametersInfo(SPI_GETMOUSE, 0, mouseParams, 0);
                  
                      // Modify the acceleration value as directed.
                      mouseParams[2] = mouseAccel;
                  
                      // Update the system setting.
                      SystemParametersInfo(SPI_SETMOUSE, 0, mouseParams, SPIF_SENDCHANGE);
                  }
                  

                  And you probably already know this, but there are too many badly-behaved applications out there for me not to mention it just in case. If you're doing this in your application, be sure to save the original value so that you can restore it when your app is closed! This is just basic etiquette when you're modifying system-wide settings.

                  这篇关于如何配置鼠标以编程方式提高指针精度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:用 C++ 创建一个简单的配置文件和解析器 下一篇:非阻塞控制台输入 C++

                  相关文章

                  <small id='kHkYr'></small><noframes id='kHkYr'>

                • <i id='kHkYr'><tr id='kHkYr'><dt id='kHkYr'><q id='kHkYr'><span id='kHkYr'><b id='kHkYr'><form id='kHkYr'><ins id='kHkYr'></ins><ul id='kHkYr'></ul><sub id='kHkYr'></sub></form><legend id='kHkYr'></legend><bdo id='kHkYr'><pre id='kHkYr'><center id='kHkYr'></center></pre></bdo></b><th id='kHkYr'></th></span></q></dt></tr></i><div id='kHkYr'><tfoot id='kHkYr'></tfoot><dl id='kHkYr'><fieldset id='kHkYr'></fieldset></dl></div>
                    <legend id='kHkYr'><style id='kHkYr'><dir id='kHkYr'><q id='kHkYr'></q></dir></style></legend>

                    • <bdo id='kHkYr'></bdo><ul id='kHkYr'></ul>

                    <tfoot id='kHkYr'></tfoot>