本文介绍了Windows 8 WinRT KeyboardCapabilities.KeyboardPresent 始终为真的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们使用 KeyboardCapabilities.KeyboardPresent 来测试键盘是否连接到设备:

We are using KeyboardCapabilities.KeyboardPresent to test if a keyboard is connected to a device:

bool hasKeyboard = new KeyboardCapabilities().KeyboardPresent == 1;

不幸的是,无论是否连接蓝牙键盘,它始终为 TRUE.我们在以下硬件上进行了尝试:

Unfortunately it's always TRUE regardless if a bluetooth keyboard is connected or not. We tried it with the following hardware:

Dell Vostro 470 是带有无线蓝牙键盘的台式电脑,具有电源开/关选项.http://www.dell.com/in/business/p/vostro-470/pd

Dell Vostro 470 is a desktop PC with wireless Bluetooth keyboard which has power ON/OFF options.http://www.dell.com/in/business/p/vostro-470/pd

三星 700T 笔记本电脑 (Slate)http://www.samsung.com/uk/consumer/pc-peripherals/slate-pc/slate-pc/XE700T1A-A01UK

Samsung 700T Notebook (Slate)http://www.samsung.com/uk/consumer/pc-peripherals/slate-pc/slate-pc/XE700T1A-A01UK

关闭键盘、蓝牙、从设备列表中删除键盘等都没有帮助,KeyboardCapabilities.KeyboardPresent 总是返回 1.

Switching off the keyboard, bluetooth, removing the keyboard from the devices list, etc. didn't help, KeyboardCapabilities.KeyboardPresent always returns 1.

我们是否在这里遗漏了什么,或者是否有我们应该使用的 API 来检测此类更改?

Are we missing something here or is there an API which we should use instead to detect such changes?

推荐答案

也有这个问题,在我的 Microsoft Surface(具有可拆卸键盘)上,KeyboardPresent 总是返回1",即使没有连接键盘(触摸/键盘盖)并且我们打开了软件键盘.

Also having this issue, on my Microsoft Surface(which has a detachable keyboard), the KeyboardPresent always returns a '1', even if no keyboard(touch/type cover) is attached and we have the software keyboard open.

这篇关于Windows 8 WinRT KeyboardCapabilities.KeyboardPresent 始终为真的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-27 03:13