Esempio n. 1
0
        private void InvokeKeyDown(KeyEventArgsExt e)
        {
            KeyEventHandler handler = KeyDown;

            if (handler == null || e.Handled || !e.IsKeyDown)
            {
                return;
            }
            handler(this, e);
        }
Esempio n. 2
0
        /// <summary>
        /// This method processes the data from the hook and initiates event firing.
        /// </summary>
        /// <param name="wParam">The first Windows Messages parameter.</param>
        /// <param name="lParam">The second Windows Messages parameter.</param>
        /// <returns>
        /// True - The hook will be passed along to other applications.
        /// <para>
        /// False - The hook will not be given to other applications, effectively blocking input.
        /// </para>
        /// </returns>
        protected override bool ProcessCallback(int wParam, IntPtr lParam)
        {
            KeyEventArgsExt      keyArgs      = KeyEventArgsExt.FromRawData(wParam, lParam, IsGlobal);
            KeyPressEventArgsExt keyPressArgs = KeyPressEventArgsExt.FromRawData(wParam, lParam, IsGlobal);

            keyPressArgs.KeyArgs = keyArgs;

            InvokeKeyDown(keyArgs);
            InvokeKeyPress(keyPressArgs);
            InvokeKeyUp(keyArgs);

            return(!(keyArgs.Handled || keyPressArgs.Handled));
        }