mirror of
https://github.com/ckaczor/Common.git
synced 2026-02-02 17:24:10 -05:00
Initial commit
This commit is contained in:
18
IO/Keyboard.cs
Normal file
18
IO/Keyboard.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user