Click here to Skip to main content
15,888,293 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,

I wrote a On screen keyboard . I get handle of GDI that clicked on that by mouse hook and WindowFromPoint . But my problem is that , how to get type of handle?

I should be recognition Editable components such as text box or combo or raido box and so on ...

Thanks in Advance.
Posted
Updated 3-Jul-11 20:21pm
v2

You should not recognize them; and this is not generally possible if this is a different application. Your virtual keyboard should simply imitate keyboard not caring about focus. For this purpose, you need to simulate keyboard input on low-level. Use Windows API SendInput, see http://msdn.microsoft.com/en-us/library/ms646310(v=vs.85).aspx[^].

There is one delicate moment with the window of your virtual keyboard. As you type by pressing keys using the mouse, it will grab the focus from your target application. To prevent this, you need to do two changes on the window style: it should be non-focusable and always-on-top, at least when you use it. Use extended styles WS_EX_NOACTIVATE | WS_EX_TOPMOST, see .http://msdn.microsoft.com/en-us/library/ff700543(v=vs.85).aspx[^]. You can do it using Windows API SetWindowLong with the parameter nIndex = GWL_EXSTYLE, see http://msdn.microsoft.com/en-us/library/ms633591(v=vs.85).aspx[^].

—SA
 
Share this answer
 
i want to use GetWindowInfo() for getting style of window . where is defined values of Control style such as BS_PUSHBUTTON ?
 
Share this answer
 
Comments
Albert Holguin 13-Jul-11 13:38pm    
why are you trying to figure this out with GDI? are you trying to figure where the user clicked?
joliuscezar 18-Jul-11 1:26am    
i want write an on screen keyboard

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