Instead of messing with the basically broken SendKeys function, you'll definitely want to take a look at the SendInput function. With SendInput, you'll have much more control over life and can properly force in any sort of input you want. I even wrote a relatively complete UI testing utility called Tester a few years ago (http://msdn.microsoft.com/msdnmag/issues/02/03/bugslayer/) that shows how to use it. It's a C++ application, but you'll get the idea.
This was first published in January 2004