How to force win10 to open virtual tablet keyboard?

让人想犯罪 __ 提交于 2019-12-12 10:40:01

问题


I have an app that needs a virtual keyboard. But, when I click some of my TextBoxes, they don't make the virtual keyboard appear. I have tried using this:

System.Diagnostics.Process.Start("osk.exe");

But this opens another keyboard, one that does not close after the TextBox has no focus. How to force win10 to open the virtual tablet keyboard?

To make myself clear:
This is running on a win10 touch screen PC. When I have the tablet mode enabled the virtual keyboard shows up on some TextBoxes and does not on others. Hence why I want to force the keyboard to show.

EDIT: I have since found a way to show the "virtual tablet keyboard", however I would like to do it using the InputPane class. Can someone provide me with a example code just to get me started?

Code to open it without using the InputPane class:

System.Diagnostics.Process.Start("TabTip.exe");

回答1:


One thing. InputPane, you cannot use in WinForms, InputPane is a element of UWP.

I ran this code... And Works!

 string progFiles = @"C:\Program Files\Common Files\Microsoft Shared\ink";
 string keyboardPath = Path.Combine(progFiles, "TabTip.exe");
 Process.Start(keyboardPath);

But I had to add a key (MANUALLY) value on my regedit on HKEY_CURRENT_USER\SOFTWARE\Microsoft\TabletTip inside the key is a folder named 1.7 (this would change in the future by Microsoft) and add a 32 bit DWORD value named EnableDesktopModeAutoInvoke with value 1. This means TRUE. It should look like this:

You can add the key programatically I think you need Admin privilegies. I tried add the key programatically but does not work, It double the entry without any effect (BE CAREFUL);

ADVICES:

Consider, do a process stopper for each process you create. I suposse that you will use this when textbox (ar any input method) request focus. be sure stop the process when component loses his focus.

hope this help.



来源:https://stackoverflow.com/questions/37249607/how-to-force-win10-to-open-virtual-tablet-keyboard

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