How to bring up the Windows 8 on-screen keyboard in a desktop app

試著忘記壹切 提交于 2019-12-21 02:24:04

问题


I have a fullscreen DirectX desktop app, and would like to display the on-screen keyboard when the user taps a textbox in my game. Is there a way to do this while in fullscreen mode?


回答1:


Executing osk.exe will pop up the more old-fashioned on-screen keyboard. The Windows 8 touch keyboard will pop up by executing

C:\Program Files\Common Files\Microsoft Shared\ink\TabTip.exe

I just figured that out, since I'm working on a fullscreen desktop app that is running on a tablet PC without keyboard attached.

Severin.




回答2:


Same answer as Severin Stampler but in order to find the correct path from c# I use:

var path = Environment.GetFolderPath(Environment.SpecialFolder.CommonProgramFiles) + @"\Microsoft Shared\ink\TabTip.exe";

if (!File.Exists(path))
{
   // older windows versions
   path = Environment.GetFolderPath(Environment.SpecialFolder.System) + @"\osk.exe";
}



回答3:


If it is a desktop app, you might need to invoke ShellExecute for osk.exe.

If it is a Metro application, then you cannot invoke the SIP from the app itself. As per the MSDN docs:

This means that applications cannot programmatically invoke the touch keyboard via manipulation of focus. Big culprits here in the past have been webpages—many of them set focus by default in




回答4:


You can show the Windows 8 touch keyboard quite easily:

http://brianlagunas.com/showing-windows-8-touch-keyboard-wpf/



来源:https://stackoverflow.com/questions/11874029/how-to-bring-up-the-windows-8-on-screen-keyboard-in-a-desktop-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!