Simulating a mouse button click in Windows

前端 未结 3 1254
遥遥无期
遥遥无期 2020-12-17 06:38

I\'m writing Remote Desktop clone in C++ using QT. So far I\'m able to move the mouse cursor around fine. QT has a nice setPos function for that. However, I\'m a bit lost as

3条回答
  •  感情败类
    2020-12-17 07:34

    Combining all togegher, here is the code for Qt:

    #include 
    QApplication::desktop()->cursor().setPos(globalX,globalY);
    mouse_event(MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_LEFTUP, 1, 1, 0, 0);
    

提交回复
热议问题