protected WindowsHook(HookType idHook, HookScope scope) { this.lpfn = this.OnWindowsHook; switch (scope) { case HookScope.LowLevelGlobal: this.hhk = SafeHookHandle.SetWindowsHook(idHook, this.lpfn, IntPtr.Zero, 0U); return; default: throw new InvalidEnumArgumentException("scope", (int)scope, typeof(HookScope)); } }
protected WindowsHook(HookType idHook, HookScope scope) { this.lpfn = this.OnWindowsHook; switch (scope) { case HookScope.LowLevelGlobal: IntPtr moduleHandle = NativeMethods.GetModuleHandle(null); this.hhk = SafeHookHandle.SetWindowsHook(idHook, this.lpfn, moduleHandle, 0U); return; default: throw new InvalidEnumArgumentException("scope", (int)scope, typeof(HookScope)); } }