If you're on Windows you can use SendInput(), though I prefer keybd_event() as it requires no setup. With SendInput(), you'll have to pass in a structure and in that structure you'll need to initialise another structure, it's just too much effort to send a keystroke. I am by far not an experienced Windows programmer nor an experienced programmer in general, but I think you'll have better luck posting in the Windows Programming section.