C# 模拟鼠标事件
2014-03-06 09:05
323 查看
#region 模拟鼠标移动 [DllImport("user32")] public static extern void SetCursorPos(int x, int y); #endregion #region 模拟鼠标单击 private static readonly int MOUSEEVENTF_LEFTDOWN = 0x2; //鼠标左键down事件 private static readonly int MOUSEEVENTF_LEFTUP = 0x4; //鼠标左键up事件 [DllImport("user32")] public static extern void mouse_event(int dwFlags, int dx, int dy, int dwData, int dwExtraInfo); #endregion //获取鼠标在屏幕的坐标 int x = Control.MousePosition.X; int y = Control.MousePosition.Y; SetCursorPos(x, y);//模拟鼠标移动 mouse_event(MOUSEEVENTF_LEFTDOWN, x, y, 0, 0);//模拟鼠标左键down mouse_event(MOUSEEVENTF_LEFTUP, x, y, 0, 0);//模拟鼠标左键up
相关文章推荐
- C#模拟键盘鼠标事件
- C# 模拟鼠标单击事件 FindWindow实例
- C#模拟键盘鼠标事件 SendKeys 的特殊键代码表
- C#中实现模拟鼠标事件
- C# 模拟鼠标点击事件
- c# 调用API mouse_event 模拟鼠标事件
- C#模拟键盘鼠标事件 SendKeys 的特殊键代码表
- C#中实现模拟鼠标事件
- C#模拟键盘鼠标事件 SendKeys 的特殊键代码表
- C#中实现模拟鼠标事件
- C#模拟键盘鼠标事件
- (转)C#模拟键盘鼠标事件
- C# 模拟鼠标.模拟键盘事件
- C#调用API:mouse_event 模拟鼠标事件
- C#模拟键盘鼠标事件
- C# 模拟鼠标事件
- 【转】C#模拟键盘鼠标事件
- C#任意位置 模拟鼠标 点击 事件 并获取 鼠标 位置 源码
- C#模拟键盘鼠标事件
- C#中实现模拟鼠标事件