directx mouse click simulation

独自空忆成欢 提交于 2019-12-11 07:49:36

问题


How can I simulate the mouse click in a directx application? mouse_event and PostMessage with WM_LBUTTONDOWN don't work...

so it must be something to do with the DirectInput

I haven't found out nothing useful with google, so you may be knowing the answer...

thanks in advance

//update

I wrote the text wrongly, what I want is to make the directx app believe that the mouse has just clicked, but without effectively using the mouse and without using SendInput or mouse_event, which need that the window must be focused


回答1:


Try AutoIt it is perfect for sending a click to a particular control. The

ControlClick ( "title", "text", controlID [, button [, clicks [, x [, y ]]]] )

command can do exactly what you want. The directx control will detect the click.




回答2:


If it is your own application, could you refactor out the click event into something like (in psuedocode):

void click(int x, int y)  {
     do_action();
}

or

void area_click(int x, int y) {
     do_action();
}

which is called by the real click handler.



来源:https://stackoverflow.com/questions/475860/directx-mouse-click-simulation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!