Send mouse clicks to X Y coordinate of another application

前端 未结 2 1246
生来不讨喜
生来不讨喜 2021-02-10 21:27

I am trying to send a simulated mouse click to another application. I understand how to actually send the key click, this is not the issue. I need to send the mouse click to the

2条回答
  •  一生所求
    2021-02-10 21:55

    Set the cursor position AND also set 0,0 as X and Y in the mouse_event routine:

    SetCursorPos(x, y);
    mouse_event(MouseEventFlag.LeftDown, 0, 0, 0, UIntPtr.Zero);
    mouse_event(MouseEventFlag.LeftUp, 0, 0, 0, UIntPtr.Zero);
    

    Working fine for me now.

提交回复
热议问题