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