I want to use virtual keyboard assembly found here http://www.codeproject.com/KB/miscctrl/touchscreenkeyboard.aspx like on screen keyboard (OSK.exe) in Windows. Can someone please tell me how can I use it so that it always stays on top and yet for user to be able to select other windows on dekstop for keyboard input, just like “on screen keyboard” in Windows, specifically I don’t know how to select last selected window (can’t use GetForegroundWindow or GetFocus only, because when user clicks on virtual keyboard it gets focused and I get handle of keyboard window itself)?
This is very urgent to me so any advice would be greatly appreciated.
Thanks in advance.
What you need to do is make your window that it cannot be activated. This is quite easily done by overriding
CreataParams. Then you can use SendKey.Send to send key presses to the currently active window, your window will never become active.Here is a simple example
One strange thing you will notice is that since your window never becomes active it does react rather strang when you drag the window. Basically the dragging works, it just does not give the visual feedback during the drag. You can address this by overriding WndProc and handling the WM_NCLBUTTONDOWN and WM_MOUSEMOVE messages.