• 模拟鼠标移动和左键单击


    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

  • 相关阅读:
    Servlet CDI Example Analysis
    JSON续
    JSON
    Ubuntu 下安装 MySQL
    Filter介绍
    Annotation相关
    Container、Injection
    Java buildTools
    Http协议
    URI URL URN 的区别
  • 原文地址:https://www.cnblogs.com/flyfish/p/1582507.html
Copyright © 2020-2023  润新知