Is there .Net replacement for GetAsyncKeyState?
.net, keyboard, winapi
Solution
You can find the P/Invoke declaration for GetAsyncKeyState from http://pinvoke.net/default.aspx/user32/GetAsyncKeyState.html
Here's the C# signature for example:
[DllImport("user32.dll")]
static extern short GetAsyncKeyState(int vKey);
Problem
In VB6, I used a call to the Windows API, GetAsyncKeyState, to determine if the user has hit the ESC key to allow them to exit out of a long running loop. ``` Declare Function GetAsyncKeyState Lib "user32" (ByVal nVirtKey As Long) As Integer ``` Is there an equivalent in pure .NET that does require a direct call to the API?