
class Extern
{
[DllImport("user32.dll")]
static extern short GetKeyState(int key);
private const int KEY_PRESSED = 0x8000;
public bool IsPressed(int key)
{
return (GetKeyState(key) & KEY_PRESSED) != 0;
}
}
