Send mouse clicks to X Y coordinate of another application

前端 未结 2 2079
野趣味
野趣味 2021-02-10 21:29

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:45

    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.

提交回复
热议问题