mirror of
https://github.com/ckaczor/Common.git
synced 2026-01-13 17:22:40 -05:00
19 lines
431 B
C#
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);
|
|
}
|
|
}
|
|
}
|