public void ClickHold(int x, int y, int delay = 0, string button = "left") { uint num = this.MakeButtonMessage(button); AutoSpy.PostMessage(this.ControlHandle, num, 0u, this.MakeLong(x, y)); Thread.Sleep(delay); AutoSpy.PostMessage(this.ControlHandle, num + 1u, 0u, this.MakeLong(x, y)); }
public void PressKey(uint key, int times = 1, int delay = 0) { for (int i = 0; i < times; i++) { AutoSpy.PostMessage(this.ControlHandle, 256u, key, 0u); AutoSpy.PostMessage(this.ControlHandle, 257u, key, 0u); Thread.Sleep(delay); } }
public static IntPtr GetHandle(string title, string className = null) { IntPtr result = AutoSpy.FindWindow(className, title); if (result.ToInt32() == 0) { throw new Exception("Handle not found"); } return(result); }
public void ResizeWindow(int width, int height, bool fixedSize = false) { if (fixedSize) { int nIndex = -16; long num = (long)AutoSpy.GetWindowLong(this.Handle, nIndex); num &= -13303809L; AutoSpy.SetWindowLong(this.Handle, nIndex, (int)num); } AutoSpy.SetWindowPos(this.Handle, IntPtr.Zero, 0, 0, width, height, 2u); }
public void ClickDrag(int startX, int startY, int endX, int endY, int delay = 0, string button = "left") { uint num = this.MakeButtonMessage(button); uint wParam = this.MakeButtonPressedMessage(button); AutoSpy.PostMessage(this.ControlHandle, num, 0u, this.MakeLong(startX, startY)); Thread.Sleep(delay / 2); AutoSpy.PostMessage(this.ControlHandle, 512u, wParam, this.MakeLong(endX, endY)); Thread.Sleep(delay / 2); AutoSpy.PostMessage(this.ControlHandle, num + 1u, 0u, this.MakeLong(endX, endY)); }
public static IntPtr GetControlHandle(string title, string control) { IntPtr handle = AutoSpy.GetHandle(title, null); IntPtr result = AutoItX.ControlGetHandle(handle, control); if (result.ToInt32() == 0) { throw new Exception("ControlHandle not found"); } return(result); }
public void Click(int x, int y, int numClicks = 1, int delay = 0, string button = "left") { uint num = this.MakeButtonMessage(button); uint lParam = this.MakeLong(x, y); for (int i = 0; i < numClicks; i++) { AutoSpy.PostMessage(this.ControlHandle, num, 0u, lParam); AutoSpy.PostMessage(this.ControlHandle, num + 1u, 0u, lParam); Thread.Sleep(delay); } }
public bool Hook() { bool result; try { MainWindowAS = new AutoSpy(AutoSpy.GetHandle(HANDLE_TITLE, null), AutoSpy.GetControlHandle(HANDLE_TITLE, BlueStacks.CONTROL_HANDLE_TITLE)); Show(true); result = true; } catch (Exception) { result = false; } return(result); }
public bool RestartAndroid() { try { AutoSpy autoSpy = new AutoSpy(AutoSpy.GetHandle(BlueStacks.HANDLE_TITLE, null), AutoSpy.GetControlHandle(BlueStacks.HANDLE_TITLE, BlueStacks.SETTINGS_HANDLE_TITLE)); autoSpy.FocusWindow(); autoSpy.Click(16, 9, 1, 0, "left"); autoSpy.PressKey(40u, 2, 100); autoSpy.PressKey(13u, 1, 100); } catch (Exception) { return(false); } return(this.Hook()); }
public bool Hook() { bool result; try { this.MainWindowAS = new AutoSpy(AutoSpy.GetHandle(BlueStacks.HANDLE_TITLE, null), AutoSpy.GetControlHandle(BlueStacks.HANDLE_TITLE, BlueStacks.CONTROL_HANDLE_TITLE)); this.SideMenuAS = new AutoSpy(AutoSpy.GetHandle("", BlueStacks.SIDE_MENU_HANDLE_TITLE)); this.Show(true); result = true; } catch (Exception) { result = false; } return(result); }
public void Opacity(int value) { AutoSpy.SetWindowLong(this.Handle, -20, AutoSpy.GetWindowLong(this.Handle, -20) ^ 524288); AutoSpy.SetLayeredWindowAttributes(this.Handle, 0u, (byte)value, 2u); }
public void HoldKey(uint key, int times = 1, int delay = 0) { AutoSpy.PostMessage(this.ControlHandle, 256u, key, 0u); Thread.Sleep(delay); AutoSpy.PostMessage(this.ControlHandle, 257u, key, 0u); }
public void Hide() { int nCmdShow = 0; AutoSpy.ShowWindow(this.Handle, nCmdShow); }
public void BringToFront() { AutoSpy.SetForegroundWindow(this.Handle); Thread.Sleep(50); }
public static int GetPixel(WindowSnap snap, int x, int y) { return(AutoSpy.ColorToInt(snap.Image.GetPixel(x, y))); }
public void Scroll(int x, int y, int scrolls = -1, int wheelDelta = 120) { AutoSpy.PostMessage(this.ControlHandle, 522u, (uint)((uint)(wheelDelta * scrolls) << 16), this.MakeLong(x, y)); }
public void Show() { int nCmdShow = 5; AutoSpy.ShowWindow(this.Handle, nCmdShow); }
public void FocusWindow() { AutoSpy.SwitchToThisWindow(this.Handle, false); Thread.Sleep(50); }
public int GetPixel(int x, int y) { return(AutoSpy.ColorToInt(this.CurrentFrame.GetPixel(x, y))); }
public bool RestartAndroid() { try { AutoSpy autoSpy = new AutoSpy(AutoSpy.GetHandle(BlueStacks.HANDLE_TITLE, null), AutoSpy.GetControlHandle(BlueStacks.HANDLE_TITLE, BlueStacks.SETTINGS_HANDLE_TITLE)); autoSpy.FocusWindow(); autoSpy.Click(16, 9, 1, 0, "left"); autoSpy.PressKey(40u, 2, 100); autoSpy.PressKey(13u, 1, 100); } catch (Exception) { return false; } return this.Hook(); }