积极答复者
Windows RT/8中如何判断是否有外接键盘

问题
答案
-
Hi,caozhongqian
这个的确是 windows 8 Api 的一个Bug, 以下提供两种方式您可以参考一下:
1.您可以通过枚举device containers的方式来判断Keyboard是否接入,MSDN上有些链接和例子您可以参考:
http://msdn.microsoft.com/en-us/library/windows/apps/hh872189.aspx
http://msdn.microsoft.com/en-us/library/windows/apps/hh967756.aspx
http://code.msdn.microsoft.com/windowsapps/Device-enumeration-sample-ae24680d
2.当您的APP中有一些需要输入的控件时,当您foucus这些控件并要输入时,您也可以通过监测是否会出现on-screen keyboard来发现外接键盘是否接入,请参考以下例子:
http://code.msdn.microsoft.com/windowsapps/Responding-to-the-9de75533
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click HERE to participate the survey. Thanks<br/> MSDN Community Support<br/> <br/> Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.- 已标记为答案 Anne JingModerator 2013年10月14日 9:44
-
谢谢您的详细解答,我现在的做法是监听KeyboardCapabilities对象的showing事件,有一个关于吊起的触摸键盘对应的Rect对象的属性,如果rect对象的Height属性不为0,则表示使用触摸键盘
- 已标记为答案 Anne JingModerator 2013年10月14日 9:44
全部回复
-
Hi,caozhongqian
这个的确是 windows 8 Api 的一个Bug, 以下提供两种方式您可以参考一下:
1.您可以通过枚举device containers的方式来判断Keyboard是否接入,MSDN上有些链接和例子您可以参考:
http://msdn.microsoft.com/en-us/library/windows/apps/hh872189.aspx
http://msdn.microsoft.com/en-us/library/windows/apps/hh967756.aspx
http://code.msdn.microsoft.com/windowsapps/Device-enumeration-sample-ae24680d
2.当您的APP中有一些需要输入的控件时,当您foucus这些控件并要输入时,您也可以通过监测是否会出现on-screen keyboard来发现外接键盘是否接入,请参考以下例子:
http://code.msdn.microsoft.com/windowsapps/Responding-to-the-9de75533
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click HERE to participate the survey. Thanks<br/> MSDN Community Support<br/> <br/> Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.- 已标记为答案 Anne JingModerator 2013年10月14日 9:44
-
谢谢您的详细解答,我现在的做法是监听KeyboardCapabilities对象的showing事件,有一个关于吊起的触摸键盘对应的Rect对象的属性,如果rect对象的Height属性不为0,则表示使用触摸键盘
- 已标记为答案 Anne JingModerator 2013年10月14日 9:44