C#自动点击按钮
public int X; public int Y; } public enum MouseEventFlags { Move = 0x0001, LeftDown = 0x0002, LeftUp = 0x0004, RightDown = 0x0008, RightUp = 0x0010, MiddleDown = 0x0020, MiddleUp = 0x0040, Wheel = 0x0800, Absolute = 0x8000 } private void AutoClick(int x, int y) { POINT p = new POINT(); GetCursorPos(out p); try { SetCursorPos(x, y); mouse_event((int)(MouseEventFlags.LeftDown | MouseEventFlags.Absolute), 0, 0, 0, IntPtr.Zero); mouse_event((int)(MouseEventFlags.LeftUp | MouseEventFlags.Absolute), 0, 0, 0, IntPtr.Zero); } finally { SetCursorPos(p.X, p.Y); } } private void Form1_Load(object sender, EventArgs e) { } private void button1_Click(object sender, EventArgs e) { Point p = this.button2.PointToScreen(button2.Location); AutoClick(p.X , p.Y ); } private void button2_MouseClick(object sender, MouseEventArgs e) { button2.Text = "哈哈,点击了!!!!!!!"; }
- 1
- 粉丝: 0
- 资源: 8
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助