LoadKeyboardLayout不会更改屏幕键盘的用户界面 [英] LoadKeyboardLayout does not change the UI of On screen keyboard

查看:643
本文介绍了LoadKeyboardLayout不会更改屏幕键盘的用户界面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经为我的应用程序激活了Windows On屏幕键盘,并更改了

I have activated the Windows On screen keyboard for my application and changed the keyboard layout to Tamil before displaying the onscreen keyboard, using the following code:

Private Const KLF_ACTIVATE As Integer = 1
Dim oskProcess As System.Diagnostics.Process

Private Sub ProdNameText_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles ProdNameText.GotFocus
        LoadKeyboardLayout("00000449", KLF_ACTIVATE)
        oskProcess = Process.Start("osk.exe") 
End Sub

我可以通过以下方式在文本框中输入泰米尔语:

I am able to type in Tamil into the text box by:

  • 按键盘上的键
  • 单击屏幕键盘上的键

但是屏幕键盘仅显示英文字符.当我单击语言栏中的泰米尔语"时,屏幕键盘上的按键会显示泰米尔字符.

But the onscreen keyboard displays the characters in English only. When I click the Tamil Language in the language bar, the keys in the onscreen keyboard shows Tamil characters.

以编程方式完成更改后,为什么屏幕键盘上的字符不会根据当前键盘布局的更改而更改?

Why the characters of the onscreen keyboard does not change according to the change in the current keyboard layout, when the change is done programmatically?

推荐答案

这是因为键盘布局是每个进程的属性.您只更改了进程的键盘布局,而不更改了osk.exe.

That's because the keyboard layout is a per-process property. You only changed the keyboard layout for your process, not for osk.exe.

没有winapi函数可以更改另一个进程的键盘布局.鉴于语言栏知道该怎么做,它仅暗示可能,但这是一个非常保密的秘密.语言栏是通过Text Services Framework api(ItfLangBarMgr等人)控制的,这是一种非常令人讨厌的api,并且很难从托管代码中使用.快速浏览一下,没有显示出明显支持更改布局的接口方法.最好/最困难/不可能的提示是osk.exe不会执行此操作,这是您希望它具有的功能.我必须建议您坚持使用语言栏.

There is no winapi function to change the keyboard layout for another process. Given that the language bar knows how to do it only provides a hint that it is possible but it is a pretty well kept secret. The language bar is controlled through the Text Services Framework api (ItfLangBarMgr et al), a quite unpleasant api and quite difficult to use from managed code. A quick glance shows no interface method that obviously supports changing a layout. Probably the best hint that this is difficult/impossible is that osk.exe doesn't do this, a feature you'd expect it to have. I'd have to recommend you stick with the language bar.

这篇关于LoadKeyboardLayout不会更改屏幕键盘的用户界面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆