I need to simulate a keypress in a third party application. Let\'s say I have a C# application that needs to send an \"8\" to the Calculator application. I can\'t use the Se
Not directly your question, but the difference between SendMessage
and PostMessage
is that Send
is a blocking call, Post
returns immediately (before the receiving application has processed it).
MSDN explains the difference: http://msdn.microsoft.com/en-us/library/ms644950(VS.85).aspx
Also if you are on vista but not on .NET 3.0 that could also be a problem:
The SendKeys class has been updated for the .NET Framework 3.0 to enable its use in applications that run on Windows Vista. The enhanced security of Windows Vista (known as User Account Control or UAC) prevents the previous implementation from working as expected.