Keystroke

Sep 15, 2014 at 9:23am
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?
Sep 15, 2014 at 9:28am
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.
Sep 16, 2014 at 7:55am
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
Sep 16, 2014 at 10:48am
Last edited on Sep 16, 2014 at 10:48am
Sep 16, 2014 at 12:03pm
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.
Sep 16, 2014 at 12:13pm
Have you used a search engine to find examples?
http://samplecodebank.blogspot.co.uk/2011/05/sendmessage-example.html
Sep 16, 2014 at 2:10pm
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.
Sep 16, 2014 at 2:21pm
Last edited on Sep 16, 2014 at 2:23pm
Topic archived. No new replies allowed.