AcTools.Windows.Input.KeyboardListener.KeyboardHookProc C# (CSharp) Method

KeyboardHookProc() private static method

private static KeyboardHookProc ( int nCode, int wParam, IntPtr lParam ) : int
nCode int
wParam int
lParam System.IntPtr
return int
        private static int KeyboardHookProc(int nCode, int wParam, IntPtr lParam) {
            if (nCode >= 0) {
                var khs = (User32.KeyboardHookStruct)Marshal.PtrToStructure(lParam, typeof(User32.KeyboardHookStruct));
                switch (wParam) {
                    case User32.WM_KEYDOWN:
                    case User32.WM_SYSKEYDOWN:
                        if (Subscribed.Any(x => x.RaiseKeyDown(khs.VirtualKeyCode))) {
                            return -1;
                        }
                        break;

                    case User32.WM_KEYUP:
                    case User32.WM_SYSKEYUP:
                        if (Subscribed.Any(x => x.RaiseKeyUp(khs.VirtualKeyCode))) {
                            return -1;
                        }
                        break;
                }
            }

            return User32.CallNextHookEx(_hookHandle, nCode, wParam, lParam);
        }