public static void WheelUp(int times = 1) { while (times-- > 0) { MouseSimulator.mouse_event(MouseSimulator.MouseEventFlag.MOUSEEVENTF_WHEEL, 0, 0, 100, 0); } }
public static void MouseUp(MouseButtons button) { if (button != MouseButtons.Left) { if (button != MouseButtons.Right) { if (button != MouseButtons.Middle) { return; } MouseSimulator.mouse_event(MouseSimulator.MouseEventFlag.MOUSEEVENTF_MIDDLEUP, 0, 0, 0, 0); } else { MouseSimulator.mouse_event(MouseSimulator.MouseEventFlag.MOUSEEVENTF_RIGHTUP, 0, 0, 0, 0); } } else { MouseSimulator.mouse_event(MouseSimulator.MouseEventFlag.MOUSEEVENTF_LEFTUP, 0, 0, 0, 0); } }
public void Play() { this.Stop(); foreach (MacroEvent macroEvent in this.events) { Common.Sleep(macroEvent.TimeSinceLastEvent); switch (macroEvent.MacroEventType) { case MacroEventType.MouseMove: MouseEventArgs mouseEventArgs = (MouseEventArgs)macroEvent.EventArgs; MouseSimulator.X = mouseEventArgs.X; MouseSimulator.Y = mouseEventArgs.Y; continue; case MacroEventType.MouseDown: MouseSimulator.MouseDown(((MouseEventArgs)macroEvent.EventArgs).Button); continue; case MacroEventType.MouseUp: MouseSimulator.MouseUp(((MouseEventArgs)macroEvent.EventArgs).Button); continue; case MacroEventType.KeyDown: KeyboardSimulator.KeyDown(((KeyEventArgs)macroEvent.EventArgs).KeyCode); KeyboardSimulator.KeyUp(Keys.A); KeyboardSimulator.KeyPress(Keys.A); KeyboardSimulator.SimulateStandardShortcut(StandardShortcut.Copy); continue; case MacroEventType.KeyUp: KeyboardSimulator.KeyUp(((KeyEventArgs)macroEvent.EventArgs).KeyCode); continue; default: continue; } } }
public static void Hide() { MouseSimulator.ShowCursor(false); }
public static void Show() { MouseSimulator.ShowCursor(true); }
public static void DoubleClick(MouseButtons button) { MouseSimulator.Click(button); MouseSimulator.Click(button); }
public static void Click(MouseButtons button) { MouseSimulator.MouseDown(button); MouseSimulator.MouseUp(button); }