/// <summary> /// 安装钩子 /// </summary> /// <returns></returns> public virtual bool InstallHook() { IntPtr pInstance = Marshal.GetHINSTANCE(Assembly.GetExecutingAssembly().ManifestModule); if (this._hook == IntPtr.Zero) { this._hookHandler = new HookProc(HookProc); this._hook = Win32Helper.SetWindowsHookEx(HookType, this._hookHandler, pInstance, 0); if (this._hook == IntPtr.Zero) { this.UnInstallHook(); return(false); } } return(true); }