Open arthasdk opened 7 years ago
Yeah the better method for this is to write a dll that intercepts the Mouse move event and the key press event. then add in an api for you to add to its stack. Then inject the dll into the game, not all games respond to Mouse or Key events some directly listen to DirectX events.
I recommend first working with AutoHotKey, test: https://www.autohotkey.com/docs/commands/ControlSend.htm https://www.autohotkey.com/docs/commands/ControlClick.htm
you might also have to try ControlSendRaw
.
If ControlSend works, then it is utilizing SendMessage
. Which this library has support for and might just need some hijacking to get to work for you.
This code is very old for me and written horribly [architecture], i don't currently have the time to re-implement this.
feel free to submit a PR
I have this game, Path of Exile, in which I am trying to automate the mouseclick, but MouseClicks are not working at all. I have tried sending it even when the application is in foreground and activated, still nothing.
I got the handle id using Spy++ and hard-coded it for testing purpose, I have tried multiple combinations of send / postmessage in AutoHotKey but to no avail. Only Autohotkey.Click Works, which activates the window, moves the mouse around and clicks in the position, just like physical mouse.
Messaging.BackgroundMouseClick(new IntPtr(0x80760), new Key(Messaging.VKeys.KEY_LBUTTON), 200,200,100);
Any help is very much appreciated. Thanks for making this library / tool.
PS: There is a paid bot in which this feature works, I have seen it, but whenever I have tried moving my physical mouse in the game window during it's operation my cursor is moved to 0,0 in the monitor, so I think the physical mouse needs to be far far away for it to work.