public Form1() { InitializeComponent(); mResHandler = new SystemEventHandler(); mResHandler.OrientationChanged += OrientationHandler; }
public static void StartScreenRecordingHook(bool captureClick, bool captureMouse, bool groupMouseMoves, bool captureKeyboard, bool captureWindow, bool activateTopLeft, bool trackActivatedWindowSize, bool trackWindowsOpenLocation, int eventResolution, string stopHookHotKey) { //create new list for commands generated GeneratedCommands = new List <ScriptCommand>(); //setup variables _performMouseClickCapture = captureClick; _performMouseMoveCapture = captureMouse; _performKeyboardCapture = captureKeyboard; _groupMouseMovesIntoSequence = groupMouseMoves; _performWindowCapture = captureWindow; _activateWindowTopLeft = activateTopLeft; _trackActivatedWindowSizes = trackActivatedWindowSize; _trackWindowOpenLocations = trackWindowsOpenLocation; _msResolution = eventResolution; StopHookKey = stopHookHotKey; //start hook _mouseHookID = SetMouseHook(_mouseProc); _keyboardHookID = SetKeyboardHook(_kbProc); //if user decided to capture window events if (_performWindowCapture) { _winEventHookHandler = new SystemEventHandler(BuildWindowCommand); _winEventHook = SetWinEventHook(_systemEvents.EventMin, _systemEvents.EventMax, IntPtr.Zero, _winEventHookHandler, 0, 0, 0); } //start stopwatch for timing all event occurences _stopWatch = new Stopwatch(); _stopWatch.Start(); //stopwatch for tracking mouse moves specifically _lastMouseMove = new Stopwatch(); _lastMouseMove.Start(); }
public void WinEventProc(IntPtr hWinEventHook, uint eventType, IntPtr hwnd, int idObject, int idChild, uint dwEventThread, uint dwmsEventTime) { if ((((SystemEventHandler != null)) && (SystemEventHandler.GetInvocationList().Length > 0))) { Hwnd = hwnd; SystemEventHandler?.Invoke(hWinEventHook, eventType, hwnd, idObject, idChild, dwEventThread, dwmsEventTime); } }
public SystemListener() { _handler = InternalSystemEventHandler; _windowCloseWinEventHook = Win32NativeMethods.SetWinEventHook(SystemEvents.ObjectDestroy, SystemEvents.ObjectDestroy, IntPtr.Zero, _handler, 0, 0, 0x0000); _windowPositionChangedEventHook = Win32NativeMethods.SetWinEventHook(SystemEvents.ObjectLocationChange, SystemEvents.ObjectLocationChange, IntPtr.Zero, _handler, 0, 0, 0x0000); _windowMovingEventHook = Win32NativeMethods.SetWinEventHook(SystemEvents.SystemMoveSizeStart, SystemEvents.SystemMoveSizeEnd, IntPtr.Zero, _handler, 0, 0, 0x0000); _windowDraggingEventHook = Win32NativeMethods.SetWinEventHook(SystemEvents.SystemDragStart, SystemEvents.SystemDragEnd, IntPtr.Zero, _handler, 0, 0, 0x0000); }
internal static extern IntPtr SetWinEventHook( SystemEvents eventMin, SystemEvents eventMax, IntPtr hmodWinEventProc, SystemEventHandler lpfnWinEventProc, uint idProcess, uint idThread, uint dwFlags);
public static void StartScreenRecordingHook(bool captureClick, bool captureMouse, bool groupMouseMoves, bool captureKeyboard, bool captureWindow, bool activateTopLeft, bool trackActivatedWindowSize, bool trackWindowsOpenLocation, int eventResolution) { //create new list for commands generated generatedCommands = new List <ScriptCommand>(); //setup variables performMouseClickCapture = captureClick; performMouseMoveCapture = captureMouse; performKeyboardCapture = captureKeyboard; groupMouseMovesIntoSequence = groupMouseMoves; performWindowCapture = captureWindow; activateWindowTopLeft = activateTopLeft; trackActivatedWindowSizes = trackActivatedWindowSize; trackWindowOpenLocations = trackWindowsOpenLocation; msResolution = eventResolution; //start hook _mouseHookID = SetMouseHook(_mouseProc); _keyboardHookID = SetKeyboardHook(_kbProc); //if user decided to capture window events if (performWindowCapture) { _WinEventHookHandler = new SystemEventHandler(BuildWindowCommand); _WinEventHook = SetWinEventHook(SystemEvents.EVENT_MIN, SystemEvents.EVENT_MAX, IntPtr.Zero, _WinEventHookHandler, 0, 0, 0); } //start stopwatch for timing all event occurences sw = new Stopwatch(); sw.Start(); //stopwatch for tracking mouse moves specifically lastMouseMove = new Stopwatch(); lastMouseMove.Start(); }
public SystemListener() { this.handler = new SystemEventHandler(InternalSystemEventHandler); this.hWinEventHook = Win32NativeMethods.SetWinEventHook(SystemEvents.EventMin, SystemEvents.EventMax, IntPtr.Zero, this.handler, 0, 0, 0x0000); }