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

相关文章:

  • 2021-08-04
  • 2021-12-18
  • 2021-12-12
  • 2022-12-23
  • 2021-12-12
  • 2022-01-11
  • 2021-04-20
  • 2021-07-09
猜你喜欢
  • 2021-12-18
  • 2022-12-23
  • 2021-12-27
  • 2022-12-23
  • 2021-12-24
相关资源
相似解决方案