I'm trying to create a on-screen keyboard for a group of disabled students at a school. So far i've managed to create the program to type out each letter/number that the user clicks on. This is fine, but I have to state the name of the active window that the text/numbers get printed.

Would anyone know how I could send a keystroke from my program to a program like Microsoft Word, Internet Explorer, Microsoft Publisher etc?

I know Microsoft Windows XP has one built in, but the keys/letters are too small for the students to press because of there conditionss. So could someone please help me.


Recommended Answers

All 5 Replies

Check out the SendKeys function - it's part of the Win32 API.

Thank you for the code, but I have already tryed that. I'm wanting to on-screen keyboard to send a keystroke to a non-active window, just like the one built into windows xp.

The SendKeys function sounds to be what you want. You'll need to get the handle of the last window to be focused, and send the keys directly to it. Unfortunately, I haven't done any Win32 programming in a while, so I'm not quite sure how you would go about it... hopefully someone with more than half a brain will come along and pull me out of this hole.

Only the window that has keyboard focus can receive keyboard events AFAIK.
You'll have to instead create some interface that will allow the virtual keyboard to send data to your application forms and fill them that way, working outside the Windows message dispatcher system.

Maybe it's changed though, I've not done any Win32 API programming in quite a while.

Thank you for all your help

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.