How do you simulate a delay in keybd_event

I have the following code

keybd_event(0x53, 0, 0, 0); //Press S key
Sleep(5000); //Sleeps for 5 seconds
keybd_event(0x53, 0, 0x0002, 0); //Release the S Key

What I thought it does is before Releasing the S key it would press AND sleep for 5 seconds so I achieve a 5 second long key press, however when I try out the code I get a quick key press then it sleeps for 5 seconds. I want to press the S key down for 5 seconds not press the s key every 5 seconds. Can some one please help me?

Also I would like to know how to format the code on this forum, when I press "code" or the <> icon nothing happens, I'm using the latest chrome, sorry about this new to the forum.
Topic archived. No new replies allowed.