2个回答
展开全部
using System;
using System.Collections.Generic;
using System.Text;
namespace MouseEvent
{
class Program
{
[System.Runtime.InteropServices.DllImport("user32.dll")]
private static extern int mouse_event(int dwFlags, int dx, int dy, int cButtons, int dwExtraInfo);
const int MOUSEEVENTF_MOVE = 0x0001;
const int MOUSEEVENTF_LEFTDOWN = 0x0002;
const int MOUSEEVENTF_LEFTUP = 0x0004;
const int MOUSEEVENTF_RIGHTDOWN = 0x0008;
const int MOUSEEVENTF_RIGHTUP = 0x0010;
const int MOUSEEVENTF_MIDDLEDOWN = 0x0020;
const int MOUSEEVENTF_MIDDLEUP = 0x0040;
const int MOUSEEVENTF_ABSOLUTE = 0x8000;
static void Main(string[] args)
{
for (int i = 0; i < 5; i++)
{
System.Threading.Thread.Sleep(1000);
//鼠标移动,坐标x,坐标y,只设置前三个参数就够了
mouse_event(MOUSEEVENTF_MOVE, 10, 0, 0, 0);
//鼠标左键点击
mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);
mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
}
}
}
}
using System.Collections.Generic;
using System.Text;
namespace MouseEvent
{
class Program
{
[System.Runtime.InteropServices.DllImport("user32.dll")]
private static extern int mouse_event(int dwFlags, int dx, int dy, int cButtons, int dwExtraInfo);
const int MOUSEEVENTF_MOVE = 0x0001;
const int MOUSEEVENTF_LEFTDOWN = 0x0002;
const int MOUSEEVENTF_LEFTUP = 0x0004;
const int MOUSEEVENTF_RIGHTDOWN = 0x0008;
const int MOUSEEVENTF_RIGHTUP = 0x0010;
const int MOUSEEVENTF_MIDDLEDOWN = 0x0020;
const int MOUSEEVENTF_MIDDLEUP = 0x0040;
const int MOUSEEVENTF_ABSOLUTE = 0x8000;
static void Main(string[] args)
{
for (int i = 0; i < 5; i++)
{
System.Threading.Thread.Sleep(1000);
//鼠标移动,坐标x,坐标y,只设置前三个参数就够了
mouse_event(MOUSEEVENTF_MOVE, 10, 0, 0, 0);
//鼠标左键点击
mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);
mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
}
}
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询