public KeyboardInterceptor(KeyBlocker blocker) { blocker.Interceptor = this; KeyBlockHandler = blocker; KeyboardProcCallback = KeyboardHookCallback; MouseProcCallback = MouseHookCallback; EnableKeyboardHook(); }
static void Main(string[] args) { NormalizeCulture(); // If triggered by the installer, close this and relaunch, to avoid hanging up the installer. if (args.Length == 1 && args[0] == "_INSTALLER_AUTOBOUNCE") { Process.Start(Application.ExecutablePath); return; } // This needs priority to prevent delaying input Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.AboveNormal; Blocker = new KeyBlocker(); using (KeyboardInterceptor intercept = new KeyboardInterceptor(Blocker)) { Blocker.AutoEnableMouse(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); MainForm = new MainBlockerForm(); Application.Run(MainForm); } }