public void SetWinHook() { KeyboardHookProcedure = new user32.HookProc(KeyboardHookProc); IsCallNextHook = true; HookID = user32.SetWindowsHookEx(user32.WH_KEYBOARD_ALL, KeyboardHookProcedure, Marshal.GetHINSTANCE(Assembly.GetExecutingAssembly().ManifestModule), 0); }