Keystroke

So I'm trying to send 2 keystrokes to a certain program. Let's say I would like to send the keystroke "1" twice, to notepad. How do I do this, is it even possible?
This ought to be in the Windows section.

If you run Spy++, you can watch the messages sent to a window. So, open Notepad, watch the keyboard messages with Spy++. Then make your program send the same messages.
So I downloaded Spy++ and got the messages that was sent to Notepad. But how can I make the program send the same messages?

De message for "123" to notepad:
000604AE P WM_KEYDOWN nVirtKey:'1' cRepeat:1 ScanCode:02fExtended:0fAltDown:0fRepeat:0fUp:0
000604AE P WM_Char chCharCode:'49' (49) cRepeat:1 ScanCode:02fExtended:0fAltDown:0fRepeat:0fUp:0
000604AE P WM_KEYUP nVirtKey:'1' cRepeat:1 ScanCode:02fExtended:0fAltDown:0fRepeat:0fUp:0
000604AE P WM_KEYDOWN nVirtKey:'2' cRepeat:1 ScanCode:03fExtended:0fAltDown:0fRepeat:0fUp:0
000604AE P WM_Char chCharCode:'50' (50) cRepeat:1 ScanCode:02fExtended:0fAltDown:0fRepeat:0fUp:0
000604AE P WM_KEYUP nVirtKey:'2' cRepeat:1 ScanCode:03fExtended:0fAltDown:0fRepeat:0fUp:0
000604AE P WM_KEYDOWN nVirtKey:'3' cRepeat:1 ScanCode:04fExtended:0fAltDown:0fRepeat:0fUp:0
000604AE P WM_Char chCharCode:'51' (15) cRepeat:1 ScanCode:02fExtended:0fAltDown:0fRepeat:0fUp:0
000604AE P WM_KEYUP nVirtKey:'3' cRepeat:1 ScanCode:04fExtended:0fAltDown:0fRepeat:0fUp:0
Last edited on
I read it a couple times now, but I'm still clueless how to use it. Also searched for some examples or tutorials but couldn't find anything useful. SO my question is could you help me out a little bit.
Have you used a search engine to find examples?
http://samplecodebank.blogspot.co.uk/2011/05/sendmessage-example.html
I guess I just don't have enough knowlegde of c++, I have no idea what to do with it. I copy paste and run it to see what happens but nothing happens and i don't even know what should happen.
Last edited on
Topic archived. No new replies allowed.