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; }