Need a way to make the comupter think keys are being pressed

Sep 21, 2012 at 11:01am
Again there must be some simple function that i'm looking for that i just can't seem to find, i know someone must have an idea of how to imitate key presses on a keyboard.
Sep 21, 2012 at 11:18am
C++ doesn't know what a keyboard is. What operating system are you using?

freopen might be what you're looking for - you can change the source of data to stdin so that it reads from a file rather than the default (which is usually a keybaord).
Last edited on Sep 21, 2012 at 11:21am
Sep 22, 2012 at 7:22pm
I was thinking that perhaps somewhere within the Windows API or such that there will be a way to mimic keyboard presses, or much simpler (for me) ASCII code input

Basically i need the program to imitate a user typing at a keyboard.

If it helps I am using windows 7 home basic, 64bit, however i want this app to be able to run on any windows version
Sep 26, 2012 at 9:49am
I've found something under WshShell.SendKeys and i'm hoping it may work for what i need it for but it looks like it might need certain characters to be marked with curely braces... i.e. {+} and {~} or such.

This is sort of what i'm looking for so if anyone knows anything that may be a little easier to use then i'd be grateful.
Oct 5, 2012 at 10:05am
Still not answered, I thought i found a solution but i cant get the VBScript to work with my C++, i've got no idea what to do.
So back to my question of is there any way todo this such as a function in the WinAPI or perhaps a simple library i could add?

Thanks guys
Oct 5, 2012 at 10:09am
Sending a window message?
SendMessage(HWND,WM_KEYDOWN,KEY,EXTRA);
Last edited on Oct 5, 2012 at 10:10am
Oct 6, 2012 at 4:03pm
I can try it, do you know what the arguments are (or how to use them)?
Last edited on Oct 10, 2012 at 9:10am
Nov 16, 2012 at 11:41am
*bump*
Topic archived. No new replies allowed.