创建一个虚拟键盘 [英] Creating a Virtual Keyboard
本文介绍了创建一个虚拟键盘的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要使用MFC创建虚拟键盘.
我是新手,不知道应该如何开始.
Hi,
I need to create a virtual keyboard using MFC.
i am a newbie and have no clue as to how i should start.
推荐答案
Codeproject:
XKeyboard-屏幕键盘 [虚拟屏幕键盘示例 [
Codeproject:
XKeyboard - on-screen keyboard[^]
Virtual On-Screen Keyboard Example[^]
关于CP和解决方案的问题相同.
看看有-CP问题 [ ^ ]
There is a same question on CP with solution.
Take a look there-CP Question[^]
如果您想要在整个系统范围内都能使用的真正的虚拟键盘,这里有两个关键点.
要模拟键盘输入,请使用Windows APISendInput
,请参见 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
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 APISendInput
, 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 callSetWindowLong
, second parameter must beGWL_EXSTYLE
. See http://msdn.microsoft.com/en-us/library/ms633591%28v=vs.85%29.aspx[^].
—SA
这篇关于创建一个虚拟键盘的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文