public KeyboardIndicator() { InitializeComponent(); try { showNumLock = ConfigurationManager.AppSettings["NumLock"].ToUpper() == "Y"; } catch (Exception) { showNumLock = false; } try { showCapsLock = ConfigurationManager.AppSettings["CapsLock"].ToUpper() == "Y"; } catch (Exception) { showCapsLock = false; } if (!showNumLock && !showCapsLock) { showNumLock = true; } this.SetStatus(); this.gHookProc = new KeyboardIndicator.HookProc(this.KeyBoardHookProc); KeyboardIndicator.SetWindowsHookEx(WH_KEYBOARD_LL, this.gHookProc, IntPtr.Zero, 0); }
public static extern int SetWindowsHookEx(int idHook, KeyboardIndicator.HookProc lpfn, IntPtr hInstance, int threadId);