int x = GetDlgItemInt(IDC_EDIT1) ;   //要移动到的 x 坐标
    int y = GetDlgItemInt(IDC_EDIT2) ;   //           y

    int cx_screen = ::GetSystemMetrics(SM_CXSCREEN);  //屏幕 宽
    int cy_screen = ::GetSystemMetrics(SM_CYSCREEN);  //

    int real_x = 65535 * x / cx_screen;  //转换后的 x
    int real_y = 65535 * y / cy_screen;  //         y

    INPUT input;
    input.type = INPUT_MOUSE;
    input.mi.dx = real_x ;
    input.mi.dy = real_y ;
    input.mi.mouseData = 0;
    input.mi.dwFlags = MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE;   //MOUSEEVENTF_ABSOLUTE 代表决对位置  MOUSEEVENTF_MOVE代表移动事件
    input.mi.time = 0;
    input.mi.dwExtraInfo = 0;

    SendInput(1,&input,sizeof(INPUT));

 

相关文章:

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