private void PlaybackMouse(Record record) { CursorPoint newPos = record.EventMouse.Location; MouseHook.MouseEvents mEvent = record.EventMouse.Action; MouseUtils.PerformMouseEvent(mEvent, newPos); }
private void ProcessMouseEvent(MouseHook.MouseEvents mAction, int mValue) { CursorPoint mPoint = GetCurrentMousePosition(); MouseEvent mEvent = new MouseEvent { Location = mPoint, Action = mAction, Value = mValue }; LogMouseEvents(mEvent); }
public static void PerformMouseEvent(MouseHook.MouseEvents mEvent, CursorPoint location) { int x = (int)location.X; int y = (int)location.Y; SetCursorPos(x, y); switch (mEvent) { case MouseHook.MouseEvents.LeftDown: mouse_event(Constants.MOUSEEVENT_LEFTDOWN, x, y, 0, 0); break; case MouseHook.MouseEvents.LeftUp: mouse_event(Constants.MOUSEEVENTF_LEFTUP, x, y, 0, 0); break; case MouseHook.MouseEvents.RightDown: mouse_event(Constants.MOUSEEVENTF_RIGHTDOWN, x, y, 0, 0); break; case MouseHook.MouseEvents.RightUp: mouse_event(Constants.MOUSEEVENTF_RIGHTUP, x, y, 0, 0); break; case MouseHook.MouseEvents.ScrollDown: mouse_event(Constants.MOUSEEVENTF_WHEEL, 0, 0, -120, 0); break; case MouseHook.MouseEvents.ScrollUp: mouse_event(Constants.MOUSEEVENTF_WHEEL, 0, 0, 120, 0); break; } if (mEvent != MouseHook.MouseEvents.MouseMove) { Thread.Sleep(30); } }