コード例 #1
0
 public static extern bool UnhookWindowsHook(HookHandle hook);
コード例 #2
0
 public static extern IntPtr CallNextHook(HookHandle hook, int code, IntPtr wParam, IntPtr lParam);
コード例 #3
0
        public void Uninstall()
        {
            lock (this)
            {

                if (!this.HookHandle.IsEmpty)
                {
                    while (true)
                    {

                        if (!UnsafeNativeMethods.UnhookWindowsHook(this.HookHandle))
                        {
                            throw new Win32Exception(Marshal.GetLastWin32Error());
                        }

                        _Handle = HookHandle.Empty;
                        this._HookProc = null;

                        return;
                    }
                }
            }
        }
コード例 #4
0
 /// <summary>
 /// Equalses the specified hook.
 /// </summary>
 /// <param name="hook">The hook.</param>
 /// <returns></returns>
 public bool Equals(HookHandle hook)
 {
     if (this._Hook.Equals(hook._Hook))
     {
         return true;
     }
     return false;
 }
コード例 #5
0
        public void Install()
        {
            if (!this.HookHandle.IsEmpty)
            {
                this.Uninstall();
            }
            while (true)
            {
                lock (this)
                {
                    this._Handle = UnsafeNativeMethods.SetWindowsHook(this.HookType, this._HookProc,
                     InstanceHandle.Empty, (uint)Window.ThreadID);
                    if (this.HookHandle.IsEmpty)
                    {
                        throw new Win32Exception(Marshal.GetLastWin32Error());
                    }

                    return;
                }
            }
        }