Click here to Skip to main content
15,893,668 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I got a question to perform softkeyboard in vc++.Actually i have to use 2 MFC application.One for placing editbox.Another for keaboard designing.if i click on editbox i have to open another mfc exe file which is for keyboard design.I could open properly the keyboard window mfc.if I click on any button in keyboard mfc i sent keystrock to editbox which is in another application and succesfully returned to keyboard mfc to clicking next button.Upto this thing my program is ok.But problem is that when i click on the next button in keyboard design keystrock sent successfully but tha problem which i am facing is that no control in the editbox.so the keystrock wont desplay in the editbox.My que is that How can I access the control variable of first mfc to second mfc ie keyboard mfc.For that that I have created a object of class which contain editbox with including headerfile.but debuger shows the error "there is no such file directory".Please reply How can i send keystrock to another application for one or more time.
Posted

1 solution

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
 
Share this answer
 
v2
Comments
Olivier Levrey 6-May-11 8:09am    
This looks like a much better approach. Have a 5 SA.
Sergey Alexandrovich Kryukov 6-May-11 8:23am    
Thank you, Olivier.
And the best thing -- I know it works; I implemented such thing.
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900