タッチスクリーンが存在するかどうかを検出する必要があるアプリを開発しています。ほとんどの場合、次のコードを使用しています。
TouchCapabilities^ tc = ref new TouchCapabilities();
return tc->TouchPresent;
問題は、これがタッチパッドに対して true を返すラップトップを持っていることです。タッチスクリーンはありません。次のコードでタッチ スクリーンが存在するかどうかを検出しようとしましたが、タッチ スクリーン セクション内で壊れることはありません。私は、HID の理解にあまり自信がないことを認めます。
Windows::Foundation::Collections::IVectorView<PointerDevice^>^ devices = Windows::Devices::Input::PointerDevice::GetPointerDevices();
for (int i = 0; i < devices->Size; ++i)
{
PointerDevice^ pd = devices->GetAt(i);
PointerDeviceType pdt = pd->PointerDeviceType;
unsigned int contacts = pd->MaxContacts;
bool integrated = pd->IsIntegrated;
for (int j = 0; j < pd->SupportedUsages->Size; ++j)
{
PointerDeviceUsage pdu = pd->SupportedUsages->GetAt(j);
unsigned int usagePage = pdu.UsagePage;
if (usagePage == 0x0D) // 0x0D is the Digitizer HID Usage Page
{
unsigned int usage = pdu.Usage;
if (pdu.Usage == 0x04) // 0x04 is the Touch Screen HID Usage ID
{
// Should be touch screen but never goes in here
}
}
}
}
タッチスクリーンを明確に検出する方法はありますか? もしそうなら、いくつかのサンプルコードを見ることは可能ですか?