This repository has been archived on 2022-08-05. You can view files and clone it, but cannot push or open issues or pull requests.
CC-Functions/W32/KeyboardReader.cs
2020-05-23 17:22:45 +02:00

18 lines
441 B
C#

using CC_Functions.W32.Native;
namespace CC_Functions.W32
{
public static class KeyboardReader
{
public static bool IsKeyDown(Keys key)
{
int state = 0;
short retVal = user32.GetKeyState((int) key);
if ((retVal & 0x8000) == 0x8000)
state |= 1;
if ((retVal & 1) == 1)
state |= 2;
return (state & 1) == 1;
}
}
}