#736 – Finding the Maximum Number of Touch Points at Run-time
January 17, 2013 1 Comment
You can write code that discovers at run-time the number of touch points supported by the hardware that you’re running on. You do this by calling the GetSystemMetrics Win32 API call.
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(); } }
Hi, I wondering is that touch input number can be change?, I mean to reduce it, for example from 10 inputs to 1 input only.