#736 – 通过代码获取硬件支持的最大触摸点数(Finding the Maximum Number of Touch Points at Run-time)

翻译 2017年06月27日 11:03:38

原文地址;https://wpf.2000things.com/2013/01/17/736-finding-the-maximum-number-of-touch-points-at-run-time/

我们可以使用Win32的API函数GetSystemMetrics 获取硬件支持的最大触摸点数。

class Program
{
    [DllImport("user32.dll")]
    static extern int GetSystemMetrics(int nIndex);
 
    // Index passed in to GetSystemMetrics() indicates
    // what data we're asking for.
    private const int SM_DIGITIZER = 94;
    private const int SM_MAXIMUMTOUCHES = 95;
 
    // Masks used to check results from SM_DIGITIZER check
    private const int NID_READY = 0x80;
    private const int NID_MULTI_INPUT = 0x40;
 
    static void Main(string[] args)
    {
        string info;
 
        int digitizer = GetSystemMetrics(SM_DIGITIZER);
 
        if ((digitizer & (NID_READY + NID_MULTI_INPUT)) == NID_READY + NID_MULTI_INPUT)
        {
            int numTouchPoints = GetSystemMetrics(SM_MAXIMUMTOUCHES);
            info = string.Format("Multitouch ready, {0} inputs supported", numTouchPoints);
        }
        else
            info = "Multitouch not supported";
 
        Console.WriteLine(info);
        Console.ReadLine();
    }
}

打印出结果如下:

736-001

你可以在“控制面板”->“系统”页中查看。

相关文章推荐

#221 – Changing a Brush at Run-Time(在Run-Time的时候改变画刷)

我们可以在Run-Time的时候改变Brush的外观属性,例如它的颜色,那么任何使用这个Bursh的控件也会自动的随着改变。 假如我们有若干个使用了SolidColorBrush 的控件 ...

Run-Time Check Failure #0 - The value of ESP was not properly saved across a function call

动态加载dll后,执行导出的C API发生运行时错误: Run-Time Check Failure #0 - The value of ESP was not properly saved a...

Run-Time Check Failure #0,The value of ESP was not properly saved 错误解决

调用DLL函数,出现错误 Run-Time Check Failure #0 - The value of ESP was not properly saved across a function ...
  • Dybinx
  • Dybinx
  • 2012-07-02 21:17
  • 18000

Sentinel_LDK_Run-time_cmd_line_6.50

  • 2012-10-18 12:23
  • 12.94MB
  • 下载

Oracle 11gR1 dbca – maximum number of sessions exceeded

Oracle11g R1 (11.1.0.6)建库的时候遇到以下问题,此问题是BUG:8343487引起的: ORA-12801: error signaled in parallel quer...

Leetcode--->Given n points on a 2D plane, find the maximum number of points that lie on the same str

Given n points on a 2D plane, find the maximum number of points that lie on the same straight line...
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:深度学习:神经网络中的前向传播和反向传播算法推导
举报原因:
原因补充:

(最多只允许输入30个字)