How to properly capture user's keystrokes in C#, i.e. respecting SHIFT key etc
How to properly capture user's keystrokes in C#, i.e. respecting SHIFT key etc I have written the following C# program to capture the user's keystrokes. It works perfectly, except that all keys are logged as lower-case without taking the SHIFT key into account (see below). I have read all of the Win32 API's documentation. Still I much be missing something. How can I correct this program to log keystrokes properly? If I enter HelloWorld!!! , the following keys are output in log.txt: HelloWorld!!! h e l l o w o r l d 1 1 1 I.e., it does not consider SHIFT, which is the purpose of GetKeyboardState() ? GetKeyboardState() The program: using System; using System.IO; using System.Diagnostics; using System.Runtime.InteropServices; using System.Windows.Forms; using System.Text; namespace CSharpKeyLogger { public static class Program { [DllImport("user32.dll")] private static extern IntPtr SetWindowsHookEx(int idHook, HookProc lpfn, IntPtr hMod, uint...