protected override void OnStart() { _hookProc = new KeyboardLowLevelHookProc(HookProc); _hookHandle = NativeMethods.SetWindowsHookEx(_hookProc); if (_hookHandle.IsInvalid) { throw new Win32Exception(); } _hookRoot = GCHandle.Alloc(this); }
internal static SafeWindowsHookHandle SetWindowsHookEx(KeyboardLowLevelHookProc proc) { return(SetWindowsHookEx(WindowsHookType.KeyboardLowLevel, proc)); }