Click here to Skip to main content
15,893,588 members
Articles / Programming Languages / XML

Global Windows Hooks

Rate me:
Please Sign up or sign in to vote.
4.80/5 (60 votes)
24 Sep 2010CPOL5 min read 397.5K   11.7K   228  
A single component that contains various Windows hooks
using System.Windows.Forms;
using System.Diagnostics;
using System.ComponentModel;

namespace WindowsHookLib
{
    /// <summary>
    /// Provides data for the WindowsHookLib.KeyboardHook.KeyDown and 
    /// WindowsHookLib.KeyboardHook.KeyUp events. 
    /// </summary>
    [DebuggerNonUserCode]
    public class KeyboardEventArgs : System.Windows.Forms.KeyEventArgs
    {
        #region ' Members '

        [DebuggerBrowsable(DebuggerBrowsableState.Never)]
        private Keys _vkCode;

        #endregion

        #region ' Properties '

        /// <summary>
        /// Gets or sets a value indicating whether the event was handled.
        /// </summary>
        [EditorBrowsable(EditorBrowsableState.Never),
        DebuggerBrowsable(DebuggerBrowsableState.Never)]
        new public bool SuppressKeyPress
        {
            get
            {
                return base.SuppressKeyPress;
            }
            set
            {
                base.SuppressKeyPress = value;
            }
        }

        /// <summary>
        /// Gets the virtual key code for a KeyDown or KeyUp event.
        /// </summary>
        public Keys VirtualKeyCode
        {
            get
            {
                return this._vkCode;
            }
        }

        #endregion

        #region ' Methods '

        /// <param name="keyData">A System.Windows.Forms.Keys representing 
        /// the key that was pressed, combined with any modifier flags that 
        /// indicate which CTRL, SHIFT, and ALT keys were pressed at the same time. 
        /// Possible values are obtained by applying bitwise OR (|) operator 
        /// to constants from the System.Windows.Forms.Keys enumeration.</param>
        /// <param name="virtualKeyCode">The virtual key code.</param>
        public KeyboardEventArgs(Keys keyData, Keys virtualKeyCode)
            : base(keyData)
        {
            this._vkCode = virtualKeyCode;
        }

        #endregion
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior) ZipEdTech
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions