# Send Keystrokes to Another App in C/C++...



## MacFromOK (Mar 19, 2001)

Does anyone have *actual working code* to do this? I can't get the *keybd_event* function or the *WM_KEYDOWN* or *WM_CHAR* messages to work on any app outside the calling program. I've tried sending vkeys, hex values, and everything else I could think of (haven't been able to find anything on the internet either). I was just wanting to open a menu on another app (such as MSpaint) for starters...

Cheers, Mac


----------



## IMM (Feb 1, 2002)

You might want to use CWnd.SendMessage to the app after you've determined it's handle?

There's a C (not C++) implementation (more general than you want I suspect) at http://wwwthep.physik.uni-mainz.de/~frink/nt.html called *Pushkeys* which may show you what to watch for.

If you want a canned class set  try http://www.codeproject.com/dialog/keystroke.asp

The Microsoft Systems Journal article on an app called tester is probably pretty good reference material as well. 
http://www.microsoft.com/msj/defaultframe.asp?page=/msj/0499/bugslayer/bugslayer0499.htm


----------



## MacFromOK (Mar 19, 2001)

Thanks IMM,

I'll try to post back and let ya know how this goes in a few days...

Cheers, Mac


----------



## MacFromOK (Mar 19, 2001)

_______________________________________________
Hey IMM,

The code from the *Pushkeys* program seems to
work fine (so far) with only minor modifications.

Thanks again.

Cheers, Mac


----------

