コード例 #1
0
        private int keyboardHookMainProcedure(int nCode, IntPtr wParam, IntPtr lParam)
        {
            var keyboardHookCode = (WinHookCode)nCode;

            var keys = (Keys)wParam;
            var keyboardHookStructure = new KeyboardHookStructure(lParam.ToInt32());

            if (keyboardHookCode == WinHookCode.Action || keyboardHookCode == WinHookCode.NoRemove)
            {
                if (this.HookExecution != null)
                {
                    if (this.HookExecution(
                            this,
                            new KeyboardHookExecutionEventArgs(
                                keyboardHookCode,
                                keys,
                                keyboardHookStructure)))
                    {
                        return(True);
                    }
                }
            }

            return(this.CallNextHook(nCode, wParam, lParam));
        }
コード例 #2
0
        private int keyboardHookMainProcedure(int nCode, IntPtr wParam, IntPtr lParam)
        {
            var keyboardHookCode = (WinHookCode)nCode;
            var keys = (Keys)wParam;
            var keyboardHookStructure = new KeyboardHookStructure(lParam.ToInt32());

            if (keyboardHookCode == WinHookCode.Action || keyboardHookCode == WinHookCode.NoRemove)
            {
                if (this.HookExecution != null)
                {
                    if (this.HookExecution(
                                           this,
                                           new KeyboardHookExecutionEventArgs(
                                               keyboardHookCode,
                                               keys,
                                               keyboardHookStructure)))
                    {
                        return True;
                    }
                }
            }

            return this.CallNextHook(nCode, wParam, lParam);
        }