This is very limiting "softkeyboard" application. You don't need the second applications with edit box. Before I explain how to make a
real Virtual Keyboard, let's finish with the design based on edit box. I think you use the edit box to type text using the "softkeyboard"; and the typed text you can later move to any other application using clipboard. If so, you would need to include it in the same application and process as the keyboard; in this way you can pass a handler to the edit box HWND and send messages to it. Is is something you're doing? This is very limiting approach.
You can create a
real Virtual Keyboard which can type directly in any application.
For this purpose, you need to use just two techniques:
1) Simulate keyboard on a low level using Windows API
SendInput
.
See
http://msdn.microsoft.com/en-us/library/ms646310(v=vs.85).aspx[
^].
2) Solve the problem of keyboard focusing and activation. To simulate typing in any window of any application, you need to keep the keyboard focus in this window. That means the parent pop-up window of this application should be activated and the text input control should have the keyboard focus. When you try to click on a button of a Virtual Keyboard it would be activated and the key focused which would make typing impossible. To prevent this, your Virtual Keyboard window should combine style
WS_EX_TOPMOST
("always on top") and
WS_EX_NOACTIVATE
. In raw Windows API, these styles are setup in the call to
CreateWindowEx
, see
http://msdn.microsoft.com/en-us/library/ms632680(v=vs.85).aspx[
^].
Look at this article by
Hans Dietrich on CodeProject:
XKeyboard - on-screen keyboard[
^]
—SA