public void Dispose() { if (eventHandle == IntPtr.Zero) { return; } ApiWinEventHook.UnhookWinEvent(eventHandle); }
private static IntPtr AddHook(uint processId, uint threadId, ApiWinEventHook.EventId eventIdMin, ApiWinEventHook.EventId eventIdMax, ApiWinEventHook.WinEventDelegate eventHandler) { IntPtr handle = ApiWinEventHook.SetWinEventHook( eventIdMin, eventIdMax, IntPtr.Zero, eventHandler, processId, threadId, ApiWinEventHook.EventSyncContext.WineventOutofcontext); return(handle); }
public WinEventHook(IntPtr handle) { this.handle = handle; handlers = new List <WinEventHookHandler>(); threadId = ApiWinEventHook.GetWindowThreadProcessId(handle, out processId); }