Beispiel #1
0
        private void buttonLoginToGame_Click(object sender, EventArgs e)
        {
            if (!checkSelectCharacter())
            {
                return;
            }

            character.Running = 1;
            updateCharacter();

            // Mở game
            openWindow();

            IntPtr hWnd = IntPtr.Zero;

            // Find define handle of project
            hWnd = AutoControl.FindWindowHandle(null, character.ID);

            if (hWnd == IntPtr.Zero)
            {
                MessageBox.Show("Không tìm thấy nhân vật này đang được chạy.");
            }
            MainAuto mMainAuto = new MainAuto(hWnd, character, textBoxStatus);

            Helper.threadList.Add(new Thread(mMainAuto.loginToGame));
            int index = Helper.threadList.Count() - 1;

            Helper.threadList[index].Name = character.ID + "logintogame";
            Helper.threadList[index].Start();
        }
Beispiel #2
0
        private void FarmChuaCong(bool chkStatus, int runTime)
        {
            if (chkStatus == true)
            {
                LoadHandle();
                for (int i = 0; i < runTime; i++)
                {
                    ClickInto(hw, ToaDo.theGioi_Main, 5);
                    Thread.Sleep(2000);
                    ClickInto(hw, ToaDo.theGioi_VoKhoiThap);//Vị trí tháp
                    Thread.Sleep(2000);
                    ClickInto(hw, ToaDo.voKhoiThap_MaxCapBoss, 10);

                    ClickInto(hw, ToaDo.voKhoiThap_TanCong, 1, 1000);
                    //AutoControl.SendClickOnPosition(hw, 502, 503);//Nút tấn công
                    Thread.Sleep(2000);
                    ClickInto(hw, ToaDo.voKhoiThap_LapDoi);
                    Thread.Sleep(2000);
                    ClickInto(hw, ToaDo.voKhoiThap_KhaiChien);
                    Thread.Sleep(2000);
                    ClickInto(hw, ToaDo.voKhoiThap_XuatChien);
                    Thread.Sleep(12000);
                    ClickInto(hw, ToaDo.voKhoiThap_XacNhan);
                    Thread.Sleep(1000);
                    ClickInto(hw, ToaDo.voKhoiThap_Thoat);
                    Thread.Sleep(1000);
                    AutoControl.SendKeyBoardDown(hw, VKeys.VK_ESCAPE);
                }
                return;
            }
        }
Beispiel #3
0
        private void button6_Click(object sender, EventArgs e)
        {
            int x = (int)numericUpDown1.Value;
            int y = (int)numericUpDown2.Value;

            EMouseKey mouseKey = EMouseKey.LEFT;

            if (checkBox1.Checked)
            {
                if (checkBox2.Checked)
                {
                    mouseKey = EMouseKey.DOUBLE_RIGHT;
                }
                else
                {
                    mouseKey = EMouseKey.RIGHT;
                }
            }
            else
            {
                if (checkBox2.Checked)
                {
                    mouseKey = EMouseKey.DOUBLE_LEFT;
                }
            }

            //Cursor.Position = new Point(x,y);

            AutoControl.MouseClick(x, y, mouseKey);
        }
Beispiel #4
0
        private void KiemTraCaiDatTieuPhiVang()
        {
            if (!kiemTraTieuPhiVang)
            {
                LoadHandle();

                ClickInto(hw, ToaDo.thanhChinh_Main, 10);
                Thread.Sleep(1000);
                ClickInto(hw, ToaDo.caiDat_Main);
                Thread.Sleep(1000);

                ClickInto(hw, ToaDo.caiDat_ChonHetTieuPhi);
                Thread.Sleep(100);

                //ClickVao(hw, ToaDo.tinhTu_Main_KhongHoatDong, 1, 2000);
                ClickInto(hw, ToaDo.thanhChinh_Main);
                AutoControl.SendKeyPress(KeyCode.ESC);

                //AutoControl.SendTextKeyBoard();
                //AutoControl.SendKeyPress(KeyCode.KEY_L);
                Thread.Sleep(50);

                ClickInto(hw, ToaDo.caiDat_AnKhungChat, 1, 300, 300);

                ClickInto(hw, ToaDo.caiDat_NhacNhoTuuQuan, 3, 300);

                ClickInto(hw, ToaDo.caiDat_NhiemVuNgayChuTuyen, 1, 200);

                kiemTraTieuPhiVang = true;
            }
        }
Beispiel #5
0
        private void FarmNgoc_PhaiTrangBi(bool chkStatus, int runTime)
        {
            if (chkStatus == true)
            {
                LoadHandle();
                ClickInto(hw, ToaDo.thanhChinh_Main, 10);

                ClickInto(hw, ToaDo.trangBi_Main, 1, 1000);

                ClickInto(hw, ToaDo.trangBi_Phai, 1, 500);

                ClickInto(hw, ToaDo.trangBi_Phai10Lan_Truoc, 1, 500);

                for (int i = 0; i < runTime; i++)
                {
                    ClickInto(hw, ToaDo.trangBi_Phai10Lan_Tiep, 1, 5100);
                }

                ClickInto(hw, ToaDo.trangBi_XacNhanPhaiXong, 1, 1000, 2000);

                AutoControl.SendKeyBoardPress(hw, VKeys.VK_ESCAPE);
                AutoControl.SendKeyBoardPress(hw, VKeys.VK_ESCAPE);
                AutoControl.SendKeyBoardPress(hw, VKeys.VK_ESCAPE);
                AutoControl.SendKeyBoardPress(hw, VKeys.VK_ESCAPE);
                //ClickVao(hw, ToaDo.tinhTu_DongCuaSo, 1);
                return;
            }
        }
Beispiel #6
0
        private void farmTinhTu(bool chkStatus, int runTime)
        {
            if (chkStatus == true)
            {
                LoadHandle();
                //ClickVao(hw, ToaDo.tinhTu_Main_KhongHoatDong);
                //for (int i = 0; i < runTime; i++)
                //{
                //    ClickVao(hw, ToaDo.tinhTu_TuMo, 1, 1);
                //    ClickVao(hw, ToaDo.tinhTu_XacNhanMua_TuMo, 1, 1);
                //}


                //Point P = new Point();

                //P = CheckImageUntilFound(RetakePicMain(), TakePicSub("TinhTu.png"));

                ClickInto(hw, CheckImageUntilFound(RetakePicMain(), TakePicSub(HinhAnh.TinhTu)), 1, 300);

                for (int i = 0; i < runTime; i++)
                {
                    ClickInto(hw, ToaDo.tinhTu_TuMo, 1, 1);
                    ClickInto(hw, ToaDo.tinhTu_XacNhanMua_TuMo, 1, 1);
                    ClickInto(hw, ToaDo.tinhTu_XacNhanKhongDuRuong, 1, 1);
                }

                AutoControl.SendKeyBoardPress(hw, VKeys.VK_ESCAPE);
                AutoControl.SendKeyBoardPress(hw, VKeys.VK_ESCAPE);
                AutoControl.SendKeyBoardPress(hw, VKeys.VK_ESCAPE);
                AutoControl.SendKeyBoardPress(hw, VKeys.VK_ESCAPE);
            }
        }
Beispiel #7
0
        private void btnClick_Click(object sender, EventArgs e)
        {
            int x = (int)numericUpDown1.Value;
            int y = (int)numericUpDown2.Value;

            EMouseKey mousekey = new EMouseKey();

            if (cbRightMouse.Checked)
            {
                if (cbDoubleClick.Checked)
                {
                    mousekey = EMouseKey.DOUBLE_RIGHT;
                }
                else
                {
                    mousekey = EMouseKey.RIGHT;
                }
            }
            else
            {
                if (cbDoubleClick.Checked)
                {
                    mousekey = EMouseKey.DOUBLE_LEFT;
                }
                else
                {
                    mousekey = EMouseKey.LEFT;
                }
            }

            //Cursor.Position = new Point(x, y);
            AutoControl.MouseClick(x, y, mousekey);
        }
Beispiel #8
0
        private void buttonClickRightOnImage_Click(object sender, EventArgs e)
        {
            AutoIT au3  = new AutoIT();
            IntPtr hWnd = IntPtr.Zero;

            // Find define handle of project
            hWnd = AutoControl.FindWindowHandle(null, textBoxTestID.Text);

            if (hWnd == IntPtr.Zero)
            {
                MessageBox.Show("Không tìm thấy nhân vật này đang được chạy.");
                return;
            }

            var imagePath = textBoxTestPath.Text;

            var screen = CaptureHelper.CaptureWindow(hWnd);

            screen.Save("test.png");
            Bitmap iBtn = ImageScanOpenCV.GetImage(imagePath);
            var    pBtn = ImageScanOpenCV.FindOutPoint((Bitmap)screen, iBtn);

            if (pBtn != null)
            {
                au3.clickRight(textBoxTestID.Text, 1, pBtn.Value.X + int.Parse(numericUpDownTestX.Value.ToString()), pBtn.Value.Y + int.Parse(numericUpDownTestY.Value.ToString()));
                Thread.Sleep(Constant.TimeShort);
            }
        }
Beispiel #9
0
        void openWindow()
        {
            if (!checkSelectCharacter())
            {
                return;
            }

            if (checkWindowOpen())
            {
                return;
            }

            IntPtr defaultHWnd = IntPtr.Zero;

            string defaultWindowName = "Adobe Flash Player 10";

            Process.Start("flash.exe", character.Link);

            do
            {
                // Find define handle of project
                defaultHWnd = AutoControl.FindWindowHandle(null, defaultWindowName);

                SetWindowText(defaultHWnd, character.ID);
            } while (defaultHWnd == IntPtr.Zero);

            MoveWindow(defaultHWnd, 0, 0, 500, 500, true);
        }
Beispiel #10
0
        public void LoginTranS()
        {
            string strCmdText;
            string userName = Environment.UserName;

            strCmdText = @"/C C:\Users\" + userName + @"\AppData\Roaming\TranS\TranS.exe";

            Process p = new Process();

            p.StartInfo.FileName  = "CMD.exe";
            p.StartInfo.Arguments = strCmdText;

            p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;

            p.Start();
            Thread.Sleep(4000);

            //click Student
            var screen = CaptureHelper.CaptureScreen();

            screen.Save("mainScreen.png");
            var subBitmap = ImageScanOpenCV.GetImage("btnHocVien.bmp");
            var resBitmap = ImageScanOpenCV.FindOutPoint((Bitmap)screen, subBitmap);

            if (resBitmap != null)
            {
                string x = (resBitmap.ToString()).Remove(0, 3).Remove(3, 7);
                string y = (resBitmap.ToString()).Remove(0, 9).Remove(3, 1);
                AutoControl.MouseClick(int.Parse(x) + 20, int.Parse(y) + 20, EMouseKey.LEFT);
            }

            Thread.Sleep(500);

            //Send Enter ID
            try
            {
                AutoControl.SendStringFocus(txtBoxID.Text);
            }
            catch (Exception)
            {
                MessageBox.Show("Bạn chưa nhập ID");
            }


            //Click Join now
            var screenID = CaptureHelper.CaptureScreen();

            screenID.Save("mainScreen.png");
            var subBitmapID = ImageScanOpenCV.GetImage("btnVaoPhong.bmp");
            var resBitmapID = ImageScanOpenCV.FindOutPoint((Bitmap)screenID, subBitmapID);

            if (resBitmapID != null)
            {
                string x1 = (resBitmapID.ToString()).Remove(0, 3).Remove(3, 7);
                string y1 = (resBitmapID.ToString()).Remove(0, 9).Remove(3, 1);
                AutoControl.MouseClick(int.Parse(x1) + 20, int.Parse(y1) + 20, EMouseKey.LEFT);
            }
            Application.Exit();
        }
Beispiel #11
0
        private void btnDienThongTin_Click(object sender, EventArgs e)
        {
            if (textBox1.Text == "" || comboBox1.Text == "")
            {
                if (textBox1.Text == "")
                {
                    MessageBox.Show("Nhập lần nộp");
                }
                else
                {
                    MessageBox.Show("Chọn dường dẫn file");
                }
            }
            else
            {
                IntPtr HWindow = IntPtr.Zero;

                do
                {
                    Process[] p = Process.GetProcessesByName("HuTechPractice");
                    switch (p.Length)
                    {
                    case 0:
                        MoApp();
                        Thread.Sleep(1000);
                        break;

                    case 1:
                        HWindow = p[0].MainWindowHandle;
                        break;

                    default:
                        for (int i = 1; i < p.Length; i++)
                        {
                            p[i].Kill();
                            Thread.Sleep(10);
                        }
                        break;
                    }
                } while (HWindow == IntPtr.Zero);

                IntPtr ChildH = IntPtr.Zero;
                ChildH = AutoControl.FindHandle(HWindow, "WindowsForms10.COMBOBOX.app.0.141b42a_r6_ad1", null);

                AutoControl.SendText(ChildH, comboBox1.Text);
                List <IntPtr> AChild = AutoControl.FindHandles(HWindow, "WindowsForms10.EDIT.app.0.141b42a_r6_ad1", null);


                AutoControl.SendText(AChild[0], textBox1.Text);
                AutoControl.SendText(AChild[1], "Lập Trình Window");
                AutoControl.SendText(AChild[2], "17DTHB2");
                AutoControl.SendText(AChild[3], "Trần Lê Minh Hoàng");
                AutoControl.SendText(AChild[4], "*****@*****.**");

                IntPtr ChildB = AutoControl.FindHandle(HWindow, "WindowsForms10.BUTTON.app.0.141b42a_r6_ad1", "Nộp bài tập");

                AutoControl.SendClickOnControlByHandle(ChildB);
            }
        }
Beispiel #12
0
        private void btnEditTittle_Click(object sender, EventArgs e)
        {
            IntPtr hWnd = IntPtr.Zero;

            hWnd = AutoControl.FindWindowHandle(null, txtApplicationName.Text.Trim());

            AutoControl.SendText(hWnd, "HowKteam.com");
        }
Beispiel #13
0
        private void button5_Click(object sender, EventArgs e)
        {
            int x = (int)trucX.Value;
            int y = (int)trucY.Value;

            //Cursor.Position = new Point(x, y);
            AutoControl.MouseClick(x, y, EMouseKey.LEFT);
        }
Beispiel #14
0
        private void button11_Click(object sender, EventArgs e)
        {
            IntPtr hWnd = IntPtr.Zero;

            hWnd = AutoControl.FindWindowHandle(null, textBox1.Text);

            AutoControl.SendText(hWnd, "howkteam.com");
        }
Beispiel #15
0
        private void button11_Click(object sender, EventArgs e)
        {
            // áp dụng mở nhiều cửa sổ để lấy catiop ///
            IntPtr hWnd = IntPtr.Zero;

            hWnd = AutoControl.FindWindowHandle(null, textBox1.Text);

            AutoControl.SendText(hWnd, "Cửa sổ 1");
        }
Beispiel #16
0
        private void button12_Click(object sender, EventArgs e)
        {
            IntPtr hWnd = IntPtr.Zero;

            hWnd = AutoControl.FindWindowHandle(null, textBox1.Text);
            var childhWnd = AutoControl.FindHandle(hWnd, textBox2.Text, textBox2.Text);

            AutoControl.SendClickOnControlByHandle(childhWnd);
        }
Beispiel #17
0
        private void button5_Click(object sender, EventArgs e)
        {
            AutoItX3 autoItX3    = new AutoItX3();
            Point    LOLlocation = new Point(805, 175);
            IntPtr   hWnd        = IntPtr.Zero;

            hWnd = AutoControl.FindWindowHandle(null, "Garena - Game Center");
            var child = AutoControl.FindHandle(hWnd, "Chrome_RenderWidgetHostHWND", null);
            var point = AutoControl.GetGlobalPoint(child, LOLlocation);
            int num   = Convert.ToInt32(textBox1.Text);

            AutoControl.BringToFront(hWnd);
            AutoControl.MouseClick(point);
            Thread.Sleep(3000);
            var belowdiendan      = new Point(425, 4);
            var pointBelowdiendan = (Point)AutoControl.GetGlobalPoint(child, belowdiendan);

            pointBelowdiendan.Y -= 20;
            AutoControl.MouseClick(pointBelowdiendan);
            Thread.Sleep(3000);
            Point writebutton     = new Point(774, 578);
            var   WritePostButton = (Point)AutoControl.GetGlobalPoint(child, writebutton);

            //autoItX3.MouseMove(WritePostButton)
            AutoControl.MouseClick(WritePostButton);
            Thread.Sleep(2000);
            var title = (Point)AutoControl.GetGlobalPoint(child, 172, 221);

            AutoControl.MouseClick(title);
            autoItX3.Send("some trash title i can put in");
            Thread.Sleep(1000);
            var content = (Point)AutoControl.GetGlobalPoint(child, 170, 269);

            AutoControl.MouseClick(content);
            autoItX3.Send("test");
            Thread.Sleep(1000);
            var uploadImage = (Point)AutoControl.GetGlobalPoint(child, 178, 493);

            AutoControl.MouseClick(uploadImage);
            Thread.Sleep(2000);
            //Thread. Sleep and send key like someimage.png;
            autoItX3.Send("Normal.png");
            Thread.Sleep(1000);
            AutoControl.SendKeyPress(KeyCode.ENTER);
            Thread.Sleep(2000);
            var link = (Point)AutoControl.GetGlobalPoint(child, 232, 535);

            AutoControl.MouseClick(link);
            var linkloc = (Point)AutoControl.GetGlobalPoint(child, 186, 560);

            AutoControl.MouseClick(linkloc);
            autoItX3.Send("https://www.youtube.com/watch?v=HKS6cp5OGMo&list=RDzhqvxdx8kIM&index=2");
            var Send = (Point)AutoControl.GetGlobalPoint(child, 772, 516);

            AutoControl.MouseClick(Send);
            // done
        }
Beispiel #18
0
        private void btnSendKey_Click(object sender, EventArgs e)
        {
            IntPtr hWnd = IntPtr.Zero;

            hWnd = AutoControl.FindWindowHandle(null, txtApplicationName.Text.Trim());

            AutoControl.BringToFront(hWnd);

            AutoControl.SendKeyFocus(KeyCode.ENTER);
        }
Beispiel #19
0
        private void button9_Click(object sender, EventArgs e)
        {
            IntPtr hWnd = IntPtr.Zero;

            hWnd = AutoControl.FindWindowHandle(null, textBox1.Text);

            AutoControl.BringToFront(hWnd);

            AutoControl.SendKeyFocus(KeyCode.ENTER);
        }
Beispiel #20
0
        private void button15_Click(object sender, EventArgs e)
        {
            IntPtr hWnd = IntPtr.Zero;

            hWnd = AutoControl.FindWindowHandle(null, textBox1.Text);

            AutoControl.SendKeyBoardPress(hWnd, VKeys.VK_RETURN);
            //AutoControl.SendKeyBoardUp(hWnd, VKeys.VK_RETURN);
            //AutoControl.SendKeyBoardDown(hWnd, VKeys.VK_RETURN);
        }
Beispiel #21
0
        private void btnSendMutilKey_Click(object sender, EventArgs e)
        {
            IntPtr hWnd = IntPtr.Zero;

            hWnd = AutoControl.FindWindowHandle(null, txtApplicationName.Text.Trim());

            AutoControl.BringToFront(hWnd);

            AutoControl.SendMultiKeysFocus(new KeyCode[] { KeyCode.CONTROL, KeyCode.KEY_V });
        }
Beispiel #22
0
        private void btnClickCtr_Click(object sender, EventArgs e)
        {
            IntPtr hWnd = IntPtr.Zero;

            hWnd = AutoControl.FindWindowHandle(null, txtApplicationName.Text.Trim());

            var childWnd = AutoControl.FindHandle(hWnd, txtClass.Text, txtClass.Text);

            AutoControl.SendClickOnControlByHandle(childWnd);
        }
Beispiel #23
0
        private void btnSetTextToCbb_Click(object sender, EventArgs e)
        {
            IntPtr hWnd = IntPtr.Zero;

            hWnd = AutoControl.FindWindowHandle(null, txtApplicationName.Text.Trim());

            var childWnd = AutoControl.FindHandle(hWnd, "ComboBoxEx32", null);

            AutoControl.SendText(childWnd, "HowKteam.com");
        }
Beispiel #24
0
        private void btnSendEnter_Click(object sender, EventArgs e)
        {
            IntPtr hWnd = IntPtr.Zero;

            hWnd = AutoControl.FindWindowHandle(null, txtApplicationName.Text.Trim());

            var childWnd = AutoControl.FindHandle(hWnd, txtClass.Text, txtClass.Text);

            AutoControl.SendKeyBoardPress(childWnd, VKeys.VK_RETURN);
        }
Beispiel #25
0
 public static void exitExploreArea()
 {
     if (isExploreArea() != true)
     {
         return;
     }
     AutoControl.SendKeyBoardPress(Global.mainHandle, VKeys.VK_ESCAPE);
     GameHelper.Delay(1200);
     GameImage.findAndClickImage(okImage);
 }
Beispiel #26
0
 public static void clickGame(int x, int y, bool doubleClick = false)
 {
     //AutoControl.SendClickOnPosition(Global.mainHandle, x, y);
     AutoControl.SendDragAndDropOnPosition(Global.mainHandle, x, y, x + 2, y + 2, 10, 10, 0.2);
     if (doubleClick)
     {
         //AutoControl.SendClickOnPosition(Global.mainHandle, x, y);
         AutoControl.SendDragAndDropOnPosition(Global.mainHandle, x, y, x + 2, y + 2);
     }
 }
Beispiel #27
0
        private void button10_Click(object sender, EventArgs e)
        {
            IntPtr hWnd = IntPtr.Zero;

            hWnd = AutoControl.FindWindowHandle(null, textBox1.Text);

            AutoControl.BringToFront(hWnd);

            AutoControl.SendMultiKeysFocus(new KeyCode[] { KeyCode.CONTROL, KeyCode.KEY_V });
        }
Beispiel #28
0
        private void button12_Click(object sender, EventArgs e)
        {
            IntPtr hWnd = IntPtr.Zero;

            hWnd = AutoControl.FindWindowHandle(null, textBox1.Text);

            //Tìm ra handle con mà thỏa text hoặc class giống
            var childhWnd = AutoControl.FindHandle(hWnd, "ComboBoxEx32", null);

            AutoControl.SendText(childhWnd, "howkteam.com");
        }
Beispiel #29
0
 /// <summary>
 /// Click vào vị trí mong muốn dựa trên Handle
 /// </summary>
 /// <param name="handle"></param>
 /// <param name="pointToClick"></param>
 /// <param name="clickTime"></param>
 /// <param name="delayAfterClick"></param>
 /// <param name="delayBeforeClick"></param>
 public static void ClickOnWindowPosition(IntPtr handle, Point pointToClick, int clickTime = 1, int delayAfterClick = 1, int delayBeforeClick = 0)
 {
     for (int i = 0; i < clickTime; i++)
     {
         if (delayBeforeClick != 0)
         {
             Thread.Sleep(delayBeforeClick);
         }
         AutoControl.SendClickOnPosition(handle, pointToClick.X, pointToClick.Y);
         Thread.Sleep(delayAfterClick);
     }
 }
Beispiel #30
0
        private void LoadHandle()
        {
            if (hWnd == IntPtr.Zero)
            {
                hWnd = AutoControl.FindWindowHandle(null, this.Text);

                if (hw == IntPtr.Zero)
                {
                    hw = AutoControl.FindHandle(hWnd, "MacromediaFlashPlayerActiveX", "MacromediaFlashPlayerActiveX");
                }
            }
        }