屏幕键盘将焦点放在工具栏上 [英] onscreen keyboard focus on the toolbar

查看:121
本文介绍了屏幕键盘将焦点放在工具栏上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我已经使用MFC创建了屏幕键盘应用程序.

现在,单击键盘上的按钮,焦点将移至另一个UI中的Edit控件.

这使应用程序可以在工具栏上切换状态.

应用程序有什么方法可以在工具栏上维护一种状态,例如Windows OSK?

Hi,

I have created an on screen keyboard application using MFC.

now on clicking the buttons in the keyboard, the focus goes to a Edit control which is in an another UI.

this makes the application to toggle states at the toolbar.

is there any way for the application to maintain one state at the toolbar like the Windows OSK??

推荐答案

这是一个已知问题.

如果要使用真正的虚拟键盘,可以在整个系统范围内使用,这里有两个关键点.

要模拟键盘输入,请使用Windows API SendInput,请参见 http://msdn.microsoft.com/en-us/library/ms646310(v=vs.85).aspx [WS_EX_NOACTIVATE | WS_EX_TOPMOST.

要在运行时设置样式,您将需要调用SetWindowLong,第二个参数必须为GWL_EXSTYLE.请参阅
http://msdn.microsoft.com/en-us/library /ms633591%28v=vs.85%29.aspx [ ^ ].

—SA
This is a known problem.

There are two keys points here, if you want the real Virtual Keyboard which would work system-wide.

For emulation of keyboard input, use Windows API SendInput, see http://msdn.microsoft.com/en-us/library/ms646310(v=vs.85).aspx[^].

Now the big problem is that you need to have a keyboard focus on the control where you "type" data. It will create a problem for the Virtual Keyboard window, as it will grab focus on each click. To overcome this problem, you need two things: the Virtual Keyboard window should not be able to activate. At the same time, it should be on top. So, you need two unusual styles: WS_EX_NOACTIVATE | WS_EX_TOPMOST.

To set the style during run time, you will need to call SetWindowLong, second parameter must be GWL_EXSTYLE. See http://msdn.microsoft.com/en-us/library/ms633591%28v=vs.85%29.aspx[^].

—SA


这篇关于屏幕键盘将焦点放在工具栏上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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