public SystemHook(SystemEventCallback callback, uint eventId) { this.callback = callback; this.detachEvent = new AutoResetEvent(false); this.detachResultAvailableEvent = new AutoResetEvent(false); this.eventId = eventId; this.Id = Guid.NewGuid(); }
internal Guid RegisterSystemEvent(SystemEventCallback callback, uint eventId) { var hookId = default(Guid); var hookReadyEvent = new AutoResetEvent(false); var hookThread = new Thread(() => { var hook = new SystemHook(callback, eventId); hook.Attach(); hookId = hook.Id; SystemHooks[hookId] = hook; hookReadyEvent.Set(); hook.AwaitDetach(); }); hookThread.SetApartmentState(ApartmentState.STA); hookThread.IsBackground = true; hookThread.Start(); hookReadyEvent.WaitOne(); return(hookId); }
public Guid RegisterSystemForegroundEvent(SystemEventCallback callback) { return(RegisterSystemEvent(callback, Constant.EVENT_SYSTEM_FOREGROUND)); }
public Guid RegisterSystemCaptureStartEvent(SystemEventCallback callback) { return(RegisterSystemEvent(callback, Constant.EVENT_SYSTEM_CAPTURESTART)); }