ATGTestInput.Input.GetAsyncKeyState C# (CSharp) Method

GetAsyncKeyState() public static method

Checks whether the specified key is currently up or down
public static GetAsyncKeyState ( Key key ) : bool
key Key The Key to check
return bool
        public static bool GetAsyncKeyState(Key key)
        {
            int vKey = KeyInterop.VirtualKeyFromKey(key);
            int resp = UnsafeNativeMethods.GetAsyncKeyState(vKey);

            if( resp == 0 )
                throw new InvalidOperationException("GetAsyncKeyStateFailed");

            return resp < 0;
        }