Files
Common/IO/Keyboard.cs
2014-04-30 16:57:42 -04:00

19 lines
431 B
C#

using System.Windows.Forms;
using System.Runtime.InteropServices;
namespace Common.IO
{
public static class Keyboard
{
[DllImport("user32.dll")]
private static extern short GetAsyncKeyState(System.Windows.Forms.Keys vKey);
public static bool IsKeyPressed(Keys keys)
{
short state = GetAsyncKeyState(keys);
return ((state & 0x8000) == 0x8000);
}
}
}