May 7, 2013 at 3:47 PM
Edited May 7, 2013 at 3:47 PM
First of all: The Input Simulator is a great project.
After migrating from VS 2008 and .NET 3.5 to VS 2012 and .NET 4 (both on Windows 7, 64 bit) I recognized, that method
didn't work anymore. Whatever the state of a key in question will be (down or up):
is returning false.
The reason for this behavior is, that GetAsyncKeyState
always returns 0 and sets error code 87 (ERROR_INVALID_PARAMETER). After changing the import signature from
static extern Int16 GetAsyncKeyState(UInt16 virtualKeyCode);
static extern Int16 GetAsyncKeyState(Int32 virtualKeyCode);
everything seems to be fixed.