B
B
Boxxy2014-04-08 12:32:46
API
Boxxy, 2014-04-08 12:32:46

Programmatically emulate a click

Hello.
There is some software, namely the game. And it has a proprietary anti-cheat.
There is such a thing in WinAPI as mouse_event() or its modern counterpart SendInput().
In the game, I need to programmatically make a click, or a lot of clicks, but not in a short period of time, but on the occurrence of a certain event.
Until recently everything was fine. But now the anti-cheat has learned to block program input after a few clicks. The number could not be established, always in different ways.
Long tests with various options did not lead to anything. Those. anti-cheat does not matter, 10 clicks pass with an interval of 20ms or 1000ms each, after 5-6 clicks the input will be blocked.
By blocking, I mean this behavior: we drove a few clicks, the anti-cheat blocked. Now, if we try to call a click (mouse_event, for example), then nothing will happen in the game window. It's in the game window. You can keep sending clicks and minimize the game to find that clicks are actually being made, but when you expand the game - again, nothing.
After a while (again, it was not possible to install), the lock "releases" and you can run a couple more clicks. And you can also not wait and restart the program that sends clicks (it does not always work).
Google licked all over, I did not find any solutions.
There is an interesting feature. I have a keyboard on which you can write macros on additional buttons. If you do something like:

Click
Goto 1

Then these clicks go into the game without problems. In such a macro, there are approximately 100-150 clicks per second.
I don’t really know how to implement this, but for now I see one option: write \ find a driver for the mouse, or emulate it.
UPDATE 1:
Based on @xandox 's suggestion, a rather interesting feature emerged.
Let's assume that the anti-cheat blocked the clicks.
Minimize the game, make one click anywhere (let it be skype, browser or notepad).
Expand the game - anti-cheat will miss one click.
Minimize the game, make any seven clicks.
Expand the game, the anti-cheat will miss seven clicks.
And so on, 3-3, 5-5, 50-50.
What it is and how to explain - I do not know yet.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
X
xandox, 2014-04-08
@xandox

And after blocking program clicks - do clicks work from the mouse?
If yes, then you need to understand how the events that you send to the program differ from the events that the system generates. I don't know much about WinAPI, but it seems to me that somewhere in the event there must be a device identifier. There is another option that the anti-cheat compares the incoming events with some GetMouseState - in which nothing really changes and, by these signs, determines that something is not clean here (by the way, this can also explain the fact that not always after the same number of clicks input is blocked and that restarting sometimes helps). Then you need to look for the opportunity to change this state as well.

V
Vitaly, 2014-04-15
@vipuhoff

Try to use the .net InputSimulator library, it is not difficult to work with it, but emulation at a fairly low level will probably work, it is the only one that works fine in my RDP session.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question