Example #1
0
        private int HookProc(int code, int wParam, ref KeyboardHookData lParam)
        {
            if (code >= 0)
            {
                Keys key = (Keys)lParam.vkCode;
                if (HookedKeys.Contains(key))
                {
                    if ((wParam == (int)KeyState.KeyUp) && (KeyUp != null))
                    {
                        KeyUp(this, new KeyHookEventArgs(key));
                    }
                }
            }

            return(User32.CallNextHookEx(hhook, code, wParam, ref lParam));
        }
Example #2
0
 [DllImport("user32.dll")] public static extern int CallNextHookEx(IntPtr idHook, int nCode, int wParam, ref KeyboardHookData lParam);