/// <summary>
        ///     Detaches the hook form the operating system.
        /// </summary>
        /// <returns>Whether or not the detach was successful.</returns>
        public virtual bool Detach()
        {
            if (this.Attached && WinHookUtility.DetachWinHook(this))
            {
                this.Attached = false;
            }

            return(!this.Attached);
        }
 /// <summary>
 ///     Calls the next hook in the call chain.
 /// </summary>
 /// <param name="nCode">Hook-specific parameter information.</param>
 /// <param name="wParam">Hook-specific message or flag.</param>
 /// <param name="lParam">Hook-specific message or flag.</param>
 /// <returns>The next hook's execution result code.</returns>
 protected virtual int CallNextHook(int nCode, IntPtr wParam, IntPtr lParam)
 {
     return(WinHookUtility.CallNextHookEx(this.HookType, nCode, wParam, lParam));
 }