Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.NET 4 - Determine the number of touch points available in Win 7

Windows 7 reports the number of touch points available to the system under the computer properties - is there a way to get that info in .NET 4?

like image 427
James Cadd Avatar asked Nov 06 '22 15:11

James Cadd


1 Answers

Windows 7 exposes this via GetSystemMetrics(SM_MAXIMUMTOUCHES). Since you need this in C#, you need to use P/Invoke:

[DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true)]
static extern int GetSystemMetrics(int nIndex);

const int SM_MAXIMUMTOUCHES = 95;

int GetPointsAvailable()
{
    return GetSystemMetrics(SM_MAXIMUMTOUCHES);
}
like image 66
Eric Brown Avatar answered Nov 14 '22 23:11

Eric Brown