简体   繁体   中英

How to Implement On-Screen Keyboard (OSK) Support with DirectX in Windows 11?

everyone. I've been researching far and wide for this problem but failed to find a solution so I would like to consult with all of you here. I hope you all wouldn't mind. Thank you in advance!

Inquiry:

We would like to support on-screen keyboard for our app's text inputs but since our app is running on UWP and DirectX, it is difficult for us to add OSK support.

Our main problem is that there is no API call which invokes virtual keyboard directly. Instead, OS automatically shows the on-screen keyboard when user presses an editable text control. That's why we can't show it directly after receiving the app command. We can only show it with text control.

The other problem is that we don't have ready-to-use text control element because we are using DirectX and we have to implement everything from the scratch. On the top of this there are no documentation about UI Automation for UWP application type, only for desktop.

The only example we can find is for Windows 8 (old threads I found in a couple of forums), which implements custom selection control using DirectX. And this example is not working under Windows 10/11 as intended.

Do you have any suggestions where/how we can start working on this? Thank you so much and any suggestion will be very much appreciated!

Just talk from the UWP side, if you want to show an onscreen keyboard in a normal UWP application, you could call it like this:

 CoreInputView.GetForCurrentView().TryShow(CoreInputViewKind.Keyboard);

Hide it:

 CoreInputView.GetForCurrentView().TryHide();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM