This is a very unreliable technique. If you wan to simulate input, you should better use really low-level method
SendInput
:
http://msdn.microsoft.com/en-us/library/windows/desktop/ms646310%28v=vs.85%29.aspx[
^].
This is how to do it in .NET:
http://www.pinvoke.net/default.aspx/user32.sendinput[
^].
However, I should warn you: using simulation of the input (of any kind, starting from the lame .NET
SendKeys
to powerful
SendInput
) for "regular" UI development would be a huge abuse. The usual .NET FCL would be quite sufficient and compatible way. Simulation of input should be used only in very special utilities. Examples include playing of keyboard/mouse macro, UI testing utilities, virtual keyboard, something like that.
—SA