Andwho.Windows.Win32.MouseHook.Uninstall_Hook C# (CSharp) Method

Uninstall_Hook() public method

卸载钩子
public Uninstall_Hook ( ) : void
return void
        public void Uninstall_Hook()
        {
            if (this.EventMouseClick == null &&
                this.EventMouseDown == null &&
                this.EventMouseMove == null &&
                this.EventMouseUp == null &&
                this.EventMouseWheel == null &&
                this.EventMouseClickExt == null &&
                this.EventMouseMoveExt == null)
            {
                if (this.MouseHookHandle != 0)
                {
                    // 卸载钩子
                    int result = NativeMethods.UnhookWindowsHookEx(this.MouseHookHandle);
                    this.MouseHookHandle = 0;
                    this.MouseDelegate = null;
                    if (result == 0)
                    {
                        int errorCode = Marshal.GetLastWin32Error();
                        throw new Win32Exception("MouseHook.Uninstall_Hook()->" + NativeMethods.GetLastErrorString(errorCode));
                    }
                }
            }
        }