public static void RightClickMouse(ILog logger, System.Drawing.Point position) { var activeProcess = GetActiveProcess(); var wowProcess = WowProcess.Get(); if (wowProcess != null) { var oldPosition = System.Windows.Forms.Cursor.Position; for (int i = 20; i > 0; i--) { SetCursorPos(position.X + i, position.Y + i); Thread.Sleep(1); } Thread.Sleep(100); PostMessage(wowProcess.MainWindowHandle, Keys.WM_RBUTTONDOWN, Keys.VK_RMB, 0); Thread.Sleep(30 + random.Next(0, 47)); PostMessage(wowProcess.MainWindowHandle, Keys.WM_RBUTTONUP, Keys.VK_RMB, 0); RefocusOnOldScreen(logger, activeProcess, wowProcess, oldPosition); } }
public static Bitmap GetBitmap() { var wowProcess = WowProcess.Get(); if (wowProcess == null) { return(new Bitmap(0, 0)); } var handle = wowProcess.MainWindowHandle; var rect = new Rect(); GetWindowRect(handle, ref rect); var bounds = new Rectangle(rect.Left, rect.Top, rect.Right - rect.Left, rect.Bottom - rect.Top); wowWindowdBounds = bounds; var result = new Bitmap(bounds.Width / 2, (bounds.Height / 2)); using (var graphics = Graphics.FromImage(result)) { graphics.CopyFromScreen(new Point(bounds.Left + bounds.Width / 4, bounds.Top + bounds.Height / 4), Point.Empty, bounds.Size); } return(result); //var bmpScreen = new Bitmap(Screen.PrimaryScreen.Bounds.Width / 2, (Screen.PrimaryScreen.Bounds.Height / 2)-100); //var graphics = Graphics.FromImage(bmpScreen); //graphics.CopyFromScreen(Screen.PrimaryScreen.Bounds.Width / 4, Screen.PrimaryScreen.Bounds.Height / 4, 0, 0, bmpScreen.Size); //graphics.Dispose(); //return bmpScreen; }
public static void RightClickMouse() { var activeProcess = GetActiveProcess(); var wowProcess = WowProcess.Get(); var oldPosition = System.Windows.Forms.Cursor.Position; PostMessage(wowProcess.MainWindowHandle, Keys.WM_RBUTTONDOWN, Keys.VK_RMB, 0); Thread.Sleep(30 + random.Next(0, 47)); PostMessage(wowProcess.MainWindowHandle, Keys.WM_RBUTTONUP, Keys.VK_RMB, 0); }
public static void RightClickMouse(ILog logger, System.Drawing.Point position) { var activeProcess = GetActiveProcess(); var wowProcess = WowProcess.Get(); var oldPosition = System.Windows.Forms.Cursor.Position; System.Windows.Forms.Cursor.Position = position; PostMessage(wowProcess.MainWindowHandle, Keys.WM_RBUTTONDOWN, Keys.VK_RMB, 0); Thread.Sleep(30 + random.Next(0, 47)); PostMessage(wowProcess.MainWindowHandle, Keys.WM_RBUTTONUP, Keys.VK_RMB, 0); RefocusOnOldScreen(logger, activeProcess, wowProcess, oldPosition); }
public static void RightClickMouse_LiamCooper(ILog logger, System.Drawing.Point position) { var activeProcess = GetActiveProcess(); var wowProcess = WowProcess.Get(); if (wowProcess != null) { var oldPosition = System.Windows.Forms.Cursor.Position; System.Windows.Forms.Cursor.Position = position; mouse_event((int)MouseEventFlags.RightDown, position.X, position.Y, 0, 0); Thread.Sleep(30 + random.Next(0, 47)); mouse_event((int)MouseEventFlags.RightUp, position.X, position.Y, 0, 0); RefocusOnOldScreen(logger, activeProcess, wowProcess, oldPosition); } }