private void button1_Click(object sender, EventArgs e)
{
SetCursorPos(350, 600);//模拟鼠标移动
mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);//模拟鼠标左键down
mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);//模拟鼠标左键up
SendKeys.Send("^v");//模拟键盘按键Ctrl+v"粘贴"
}
#region 模拟鼠标移动
[DllImport("user32")]
public static extern void SetCursorPos(int x, int y);
#endregion
#region 模拟鼠标单击
private readonly int MOUSEEVENTF_LEFTDOWN = 0x2;
private readonly int MOUSEEVENTF_LEFTUP = 0x4;
[DllImport("user32")]
public static extern void mouse_event(int dwFlags, int dx, int dy, int dwData, int dwExtraInfo);
#endregion