示例#1
0
        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));
        }
示例#2
0
 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);
     }
 }
示例#3
0
        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);
        }
示例#4
0
 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);
 }
示例#5
0
        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));
        }
示例#6
0
        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);
        }
示例#7
0
        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);
            }
        }
示例#8
0
        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);
        }
示例#9
0
 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());
 }
示例#10
0
        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);
        }
示例#11
0
 public void Opacity(int value)
 {
     AutoSpy.SetWindowLong(this.Handle, -20, AutoSpy.GetWindowLong(this.Handle, -20) ^ 524288);
     AutoSpy.SetLayeredWindowAttributes(this.Handle, 0u, (byte)value, 2u);
 }
示例#12
0
 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);
 }
示例#13
0
        public void Hide()
        {
            int nCmdShow = 0;

            AutoSpy.ShowWindow(this.Handle, nCmdShow);
        }
示例#14
0
 public void BringToFront()
 {
     AutoSpy.SetForegroundWindow(this.Handle);
     Thread.Sleep(50);
 }
示例#15
0
 public static int GetPixel(WindowSnap snap, int x, int y)
 {
     return(AutoSpy.ColorToInt(snap.Image.GetPixel(x, y)));
 }
示例#16
0
 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));
 }
示例#17
0
        public void Show()
        {
            int nCmdShow = 5;

            AutoSpy.ShowWindow(this.Handle, nCmdShow);
        }
示例#18
0
 public void FocusWindow()
 {
     AutoSpy.SwitchToThisWindow(this.Handle, false);
     Thread.Sleep(50);
 }
示例#19
0
 public int GetPixel(int x, int y)
 {
     return(AutoSpy.ColorToInt(this.CurrentFrame.GetPixel(x, y)));
 }
示例#20
0
 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();
 }