下面的代码在Windows 7上运行正常,但在Windows Embedded Standard 7上运行不正常:
[System.Runtime.InteropServices.DllImport("user32.dll")]
public static extern int GetSystemMetrics(int nIndex);
public static bool isTouchEnabled()
{
int MAXTOUCHES_INDEX = 0x95;
int maxTouches = GetSystemMetrics(MAXTOUCHES_INDEX);
return maxTouches > 0;
}
答案 0 :(得分:1)
你可以试试这个:
var hasTouch = Windows.Devices.Input
.PointerDevice.GetPointerDevices()
.Any(p => p.PointerDeviceType == Windows.Devices.Input.PointerDeviceType.Touch);
有关详情,请查看此reference