PDA

View Full Version : Sending keystrokes to other Applications (Windows XP)



skainz
11th May 2007, 09:41
Hello !

I'm thinking about a way to send keystrokes/text strings to other, non-QT applications.
I'm wondering if it is possible to use the win32 api to send keypress-events to specific windows. My problem is how to get, the WindowID of, say Word or Notepad. I tried to use EnumDesktops and EnumDesktopWindows, but i really have no clue how to do it. I wanted to use mingwm's libuser32 and mingw's winduser.h but to no success (lots of problems with typedefs, maybe i can unwind this sometime...)

Anyway, is this the way to go ? Or are there simpler methods ? I was also thinking about using the clipboard to transfer text...

TIA, Simon

marcel
11th May 2007, 09:51
Try the FindWindow family functions to get the window handle for a specific window.
Also you can all the existing windows, but it would be a little difficult to select the actual windows.

Do a little search on www.codeproject.com, because there are a few Spy++-like projects.