Archived

This topic is now archived and is closed to further replies.

Sending keystrokes to another app?

This topic is 5048 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am making a very simple application for a certain private use. I need to send, from a Win32 Console app, fake keystrokes to a window. Is there any relatively easy way to do this from a console app? (I am using Dev C++)

Share this post


Link to post
Share on other sites
thats kind of funny because i too, am working on an app for private use and i need to send fake keystrokes to my window as well. purpose of the program is to keep the computer from going into standy mode because i dont have access to system settings. i tried PostMessage(hwnd,WM_KEYDOWN,NULL,NULL) but this doesnt seem to work because my screen saver still activates... any advice?

Share this post


Link to post
Share on other sites
SendInput() for Win NT based systems.
keybd_event() for Win9x systems.

Before you call these functions try giving the appropriate control of the appropriate window focus.


Thanks Salsa!Colin Jeanne | Invader''s Realm
"I forgot I had the Scroll Lock key until a few weeks ago when some asshole program used it. It even used it right" - Conner McCloud

Share this post


Link to post
Share on other sites