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); }
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); }
private void button8_Click(object sender, EventArgs e) { int x = (int)numericUpDown1.Value; int y = (int)numericUpDown2.Value; IntPtr hWnd = IntPtr.Zero; hWnd = AutoControl.FindWindowHandle(null, textBox1.Text); var childhWnd = IntPtr.Zero; // Tìm ra handle con mà thỏa điều kiện text và class y chang //childhWnd = AutoControl.FindWindowExFromParent(hWnd, null, textBox2.Text); //Tìm ra handle con mà thỏa text hoặc class giống childhWnd = AutoControl.FindHandle(hWnd, textBox2.Text, textBox2.Text); // lấy ra tọa độ trên màn hình của tọa độ bên trong cửa sổ var pointToClick = AutoControl.GetGlobalPoint(childhWnd, x, y); 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; } } AutoControl.BringToFront(hWnd); AutoControl.MouseClick(pointToClick, mouseKey); }
private void btnFo4_Click_1(object sender, EventArgs e) { FO4.StartInfo.FileName = "E:\\FileDesktop\\FOT4"; FO4.Start(); FO4.StartInfo.FileName = "E:\\FileDesktop\\Garena"; FO4.Start(); FO4.WaitForInputIdle(); IntPtr hWnd = IntPtr.Zero; hWnd = AutoControl.FindWindowHandle(tbClickApp.Text, null); var pointToClick = AutoControl.GetGlobalPoint(hWnd, 600, 430); EMouseKey mousekey = EMouseKey.LEFT; if (cbRightMouse.Checked) { if (cbDoubleClick.Checked) { mousekey = EMouseKey.DOUBLE_RIGHT; } else { mousekey = EMouseKey.RIGHT; } } else { if (cbDoubleClick.Checked) { mousekey = EMouseKey.DOUBLE_LEFT; } } AutoControl.BringToFront(hWnd); //Cursor.Position = new Point(x, y); AutoControl.MouseClick(pointToClick, mousekey); }
private void btnClickControlApp_Click(object sender, EventArgs e) { int x = (Int32)pointCursorX.Value; int y = (Int32)pointCursorY.Value; //var hWnd = Process.GetProcessById(3652).MainWindowHandle; IntPtr hWnd = IntPtr.Zero; hWnd = AutoControl.FindWindowHandle(null, txtApplicationName.Text.Trim()); var childWnd = IntPtr.Zero; childWnd = AutoControl.FindHandle(hWnd, txtClass.Text, txtClass.Text); var pointToClick = AutoControl.GetGlobalPoint(childWnd, x, y); EMouseKey eMouseKey = EMouseKey.LEFT; if (chkMouseRightClick.Checked) { if (chkMouseDoubleClick.Checked) { eMouseKey = EMouseKey.DOUBLE_RIGHT; } else { eMouseKey = EMouseKey.RIGHT; } } else { if (chkMouseDoubleClick.Checked) { eMouseKey = EMouseKey.DOUBLE_LEFT; } } AutoControl.BringToFront(hWnd); AutoControl.MouseClick(pointToClick, eMouseKey); }
private void button7_Click(object sender, EventArgs e) { try { int x = (int)numericUpDown1.Value; int y = (int)numericUpDown2.Value; Point pointToClick = new Point(x, y); EMouseKey key = EMouseKey.LEFT; IntPtr handle = IntPtr.Zero; if (textBox3.Text != null && textBox4.Text != null) { handle = AutoControl.FindWindowHandle(textBox4.Text, textBox3.Text); pointToClick = AutoControl.GetGlobalPoint(handle, x, y); } if (checkBox1.Checked) { key = EMouseKey.RIGHT; } else { key = EMouseKey.DOUBLE_RIGHT; } if (checkBox2.Checked) { key = EMouseKey.LEFT; } else { key = EMouseKey.DOUBLE_LEFT; } AutoControl.BringToFront(handle); AutoControl.MouseClick(pointToClick, key); } catch (Exception) { MessageBox.Show("Error!"); } }
private void button7_Click(object sender, EventArgs e) { int x = (int)numericUpDown1.Value; int y = (int)numericUpDown2.Value; //var hWnd = Process.GetProcessById(12012).MainWindowHandle; //var hWnd = Process.GetProcessesByName("Remote Desktop Connection")[0].MainWindowHandle; IntPtr hWnd = IntPtr.Zero; hWnd = AutoControl.FindWindowHandle(null, textBox1.Text); // lấy ra tọa độ trên màn hình của tọa độ bên trong cửa sổ. Use Autoit window info var pointToClick = AutoControl.GetGlobalPoint(hWnd, x, y); 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; } } AutoControl.BringToFront(hWnd); // Cursor.Position = new Point(x, y); AutoControl.MouseClick(pointToClick, mouseKey); }
/// <summary> /// 添加鼠标监听 /// </summary> /// <param name="objTarget">监听对象</param> /// <param name="eventtype">监听事件类型</param> /// <param name="mousekey">鼠标键</param> /// <param name="newListener">监听者接口</param> public void AddMouseEventListener(GameObject objTarget, EMouseEvent eventtype, EMouseKey mousekey, DlgtMouseEventListener newListener, object objListener = null, bool insertFirst = false) { List <ListenerInfo> listListeners = null; MouseEventKey eventkey = new MouseEventKey(objTarget, eventtype, mousekey); m_dicMouseEvents.TryGetValue(eventkey, out listListeners); if (listListeners == null) { listListeners = new List <ListenerInfo>(); ListenerInfo listenerinfo = new ListenerInfo(newListener, objListener); listListeners.Add(listenerinfo); m_dicMouseEvents[eventkey] = listListeners; } else { bool bFound = false; for (int i = 0; i < listListeners.Count; i++) { if (listListeners[i].listener == newListener && listListeners[i].objListener == objListener) { break; } } if (!bFound) { ListenerInfo listenerinfo = new ListenerInfo(newListener, objListener); if (insertFirst) { listListeners.Insert(0, listenerinfo); } else { listListeners.Add(listenerinfo); } } } }
private void button1_Click(object sender, EventArgs e) { int x = (int)numericUpDown1.Value; int y = (int)numericUpDown2.Value; IntPtr hWnd = IntPtr.Zero; hWnd = AutoControl.FindWindowHandle(tbClickApp.Text, null); var pointToClick = AutoControl.GetGlobalPoint(hWnd, x, y); EMouseKey mousekey = EMouseKey.LEFT; if (cbRightMouse.Checked) { if (cbDoubleClick.Checked) { mousekey = EMouseKey.DOUBLE_RIGHT; } else { mousekey = EMouseKey.RIGHT; } } else { if (cbDoubleClick.Checked) { mousekey = EMouseKey.DOUBLE_LEFT; } } AutoControl.BringToFront(hWnd); //Cursor.Position = new Point(x, y); AutoControl.MouseClick(pointToClick, mousekey); }
private void button18_Click(object sender, EventArgs e) { var handle = AutoControl.FindWindowHandle("LDMultiPlayerMainFrame" == "" ? null : "LDMultiPlayerMainFrame", "" == "" ? null : ""); #region // khởi tạo và restore file backup #endregion #region // ấn nút bắt đầu var sub = (Bitmap)Bitmap.FromFile("data//data.png"); var main = (Bitmap)CaptureHelper.CaptureWindow(handle); var point = ImageScanOpenCV.FindOutPoint(main, sub); if (point != null) { // AutoControl.SendClickOnPosition(handle, point.Value.X, point.Value.Y); var pointToClick = AutoControl.GetGlobalPoint(handle, point.Value.X + 7, point.Value.Y + 5); EMouseKey mouseKey = EMouseKey.DOUBLE_LEFT; AutoControl.BringToFront(handle); AutoControl.MouseClick(pointToClick, mouseKey); } #endregion }
public MouseEventKey(GameObject obj, EMouseEvent type, EMouseKey key) { target = obj; eventtype = type; mousekey = key; }
public void RemoveMouseEventListener(EMouseEvent eventtype, EMouseKey mousekey, DlgtMouseEventListener listener, object objListener = null) { RemoveMouseEventListener(null, eventtype, mousekey, listener, objListener); }
public void RemoveMouseEventListener(GameObject objTarget, EMouseEvent eventtype, EMouseKey mousekey, DlgtMouseEventListener listener, object objListener = null) { List <ListenerInfo> listListeners = null; MouseEventKey eventkey = new MouseEventKey(objTarget, eventtype, mousekey); m_dicMouseEvents.TryGetValue(eventkey, out listListeners); if (listListeners != null) { for (int i = 0; i < listListeners.Count; i++) { if (listListeners[i].listener == listener && listListeners[i].objListener == objListener) { listListeners.RemoveAt(i); break; } } if (listListeners.Count == 0) { m_dicMouseEvents.Remove(eventkey); } } }
public void AddMouseEventListener(EMouseEvent eventtype, EMouseKey mousekey, DlgtMouseEventListener newListener, object objListener = null, bool insertFirst = false) { AddMouseEventListener(null, eventtype, mousekey, newListener, objListener, insertFirst); }