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(); }
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); } }
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); }
private void btnEditTittle_Click(object sender, EventArgs e) { IntPtr hWnd = IntPtr.Zero; hWnd = AutoControl.FindWindowHandle(null, txtApplicationName.Text.Trim()); AutoControl.SendText(hWnd, "HowKteam.com"); }
private void button11_Click(object sender, EventArgs e) { IntPtr hWnd = IntPtr.Zero; hWnd = AutoControl.FindWindowHandle(null, textBox1.Text); AutoControl.SendText(hWnd, "howkteam.com"); }
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"); }
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); }
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 }
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"); }
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); }
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 }); }
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); }
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); }
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); }
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); }
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 }); }
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"); }
private void LoadHandle() { if (hWnd == IntPtr.Zero) { hWnd = AutoControl.FindWindowHandle(null, this.Text); if (hw == IntPtr.Zero) { hw = AutoControl.FindHandle(hWnd, "MacromediaFlashPlayerActiveX", "MacromediaFlashPlayerActiveX"); } } }
private void button11_Click(object sender, EventArgs e) { IntPtr hWnd = IntPtr.Zero; hWnd = AutoControl.FindWindowHandle(null, textBox1.Text); AutoControl.SendText(hWnd, "VSN ..."); var childhWnd = AutoControl.FindHandle(hWnd, "ComboBoxEx32", null); AutoControl.SendText(childhWnd, "gnassang.wap.sh"); }
private void button3_Click(object sender, EventArgs e) { IntPtr hWnd = IntPtr.Zero; hWnd = AutoControl.FindWindowHandle("Notepad", null); var child = AutoControl.FindHandle(hWnd, "edit", null); AutoControl.BringToFront(hWnd); AutoControl.MouseClick(400, 400); Thread.Sleep(300); mouse_event(MOUSEEVENTF_WHEEL, 0, 0, -720, (UIntPtr)0); }
void getOnmyojiHandle() { Global.mainHandle = AutoControl.FindWindowHandle(null, "Onmyoji"); if (Global.mainHandle == IntPtr.Zero) { GameHelper.Log("Khong tim thay cua so game. Vui long mo game truoc khi tiep tuc"); return; } else { GameHelper.Log("Da tim thay cua so game"); } }
private void btnClickPointHide_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); int x = (Int32)pointCursorX.Value; int y = (Int32)pointCursorY.Value; AutoControl.SendClickUpOnPosition(hWnd, x, y); }
private void button15_Click(object sender, EventArgs e) { IntPtr hWnd = IntPtr.Zero; hWnd = AutoControl.FindWindowHandle(null, textBox1.Text); AutoControl.SendKeyBoardPress(hWnd, VKeys.VK_RETURN); /* * Bài tập: * Nhấn vào combobox -> gửi phím down để chọn ip kế tiếp * Phải chạy ngầm hết */ }
private void MoRuong() { IntPtr hWnd = IntPtr.Zero; hWnd = AutoControl.FindWindowHandle(null, this.Text); var hw = AutoControl.FindHandle(hWnd, "MacromediaFlashPlayerActiveX", "MacromediaFlashPlayerActivX"); while (!dangMoRuong) { ClickInto(hw, ToaDo.tinhTu_TuMo, 1, 1); ClickInto(hw, ToaDo.tinhTu_XacNhanMua_TuMo, 1, 1); } }
private void button14_Click(object sender, EventArgs e) { IntPtr hWnd = IntPtr.Zero; hWnd = AutoControl.FindWindowHandle(null, textBox1.Text); var childhWnd = AutoControl.FindHandle(hWnd, textBox2.Text, textBox2.Text); int x = (int)numericUpDown1.Value; int y = (int)numericUpDown2.Value; // Phải click vào handle con. Không thể click vào handle window // Không phải ứng dụng nào cũng click được. AutoControl.SendClickOnPosition(childhWnd, x, y); }
private void button9_Click(object sender, EventArgs e) { try { int x = (int)numericUpDown1.Value; int y = (int)numericUpDown2.Value; var handle = AutoControl.FindWindowHandle(textBox4.Text, textBox3.Text); AutoControl.BringToFront(handle); AutoControl.SendMultiKeysFocus(new KeyCode[] { KeyCode.CONTROL, KeyCode.KEY_Z }); } catch (Exception) { MessageBox.Show("Error!"); } }
public bool checkWindowOpen() { IntPtr targetHWnd = IntPtr.Zero; string targetWindowName = mCharacter.ID; // Find define handle of project targetHWnd = AutoControl.FindWindowHandle(null, targetWindowName); if ((targetHWnd != IntPtr.Zero)) { return(true); } return(false); }
private void button10_Click(object sender, EventArgs e) { try { int x = (int)numericUpDown1.Value; int y = (int)numericUpDown2.Value; var handle = AutoControl.FindWindowHandle(textBox4.Text, textBox3.Text); AutoControl.BringToFront(handle); AutoControl.SendKeyFocus(KeyCode.ENTER); } catch (Exception) { MessageBox.Show("Error!"); } }
private void button2_Click(object sender, EventArgs e) { int x = 947; int y = 118; IntPtr hWnd = IntPtr.Zero; hWnd = AutoControl.FindWindowHandle(null, "Garena - Game Center"); var child = AutoControl.FindHandle(hWnd, "Chrome_RenderWidgetHostHWND", null); var point = AutoControl.GetGlobalPoint(child, x, y); AutoControl.BringToFront(hWnd); AutoControl.MouseClick(AutoControl.GetGlobalPoint(child, 10, 10)); mouse_event(MOUSEEVENTF_WHEEL, 0, 0, -720, (UIntPtr)0); AutoControl.Click(); //AutoControl.SendKeyDown() }
public void openWindow() { IntPtr defaultHWnd = IntPtr.Zero; string defaultWindowName = "Adobe Flash Player 10"; Process.Start("flash.exe", mCharacter.Link); do { // Find define handle of project defaultHWnd = AutoControl.FindWindowHandle(null, defaultWindowName); SetWindowText(defaultHWnd, mCharacter.ID); } while (defaultHWnd == IntPtr.Zero); }