public Hooks() { this.dEvent = new Hooks.WinEventDelegate(this.WinEvent); this.pHook = Hooks.SetWinEventHook(32769u, 32769u, IntPtr.Zero, this.dEvent, 0u, 0u, 0u); this.qHook = Hooks.SetWinEventHook(22u, 22u, IntPtr.Zero, this.dEvent, 0u, 0u, 0u); this.rHook = Hooks.SetWinEventHook(23u, 23u, IntPtr.Zero, this.dEvent, 0u, 0u, 0u); this.sHook = Hooks.SetWinEventHook(3u, 3u, IntPtr.Zero, this.dEvent, 0u, 0u, 0u); GC.KeepAlive(this.dEvent); GC.KeepAlive(this.qHook); GC.KeepAlive(this.pHook); GC.KeepAlive(this.rHook); GC.KeepAlive(this.sHook); }
private static extern IntPtr SetWinEventHook(uint eventMin, uint eventMax, IntPtr hmodWinEventProc, Hooks.WinEventDelegate lpfnWinEventProc, uint idProcess, uint idThread, uint dwFlags);