Thursday, November 8, 2012

How to simulate mouse and keyboard ?


The easiest way to do it is to use SendInput function.
here is a link explaining how to do it, and, trust me, it does work

Be aware that you can be detected as using a bot, that why you should use this function only if you are playing on site where botting is not forbidden

The problem is the poker software can use GetAsyncKeyState function to check if the button was pressed, and unfortunately SendInput cannot trick this function. Maybe there is a workaround to clear this key state ? I don't know, but as long as you are using this kind of api, your program won't behave the same way as human does, and you will still have risk to be detected

OpenHoldem or WinHoldem platform are using bring.exe program which is a close source software, so I don't know how it works, but I suppose that it's using SendInput function. I would not try to use bring.exe with pokerstars without knowing what he is doing.

Create a fake mouse and keyboard driver

This is a good solution if you are using a real computer (not a virtual machine). There is no way to find if a button was pressed by the your bot or by a human, well ... it's not completely true.
The application may check the driver and check build date, checksum. (is it possible that a player have a unknown mouse driver ?)

Create a fake usb mouse and keyboard

I'm not talking about creating your own driver as I does previously, but I'm talking about using usb  communication to simulate a standard usb mouse or a standard usb keyboard.
If you are going this way, note that you can buy a dvi to usb (or vga to usb) adapator. So you will be able to analyse your picture without to have any running application on the computer where you run the poker client.

use vmware or virtualbox api/sdk

If you are using a virtual machine then you should try to use theses solutions as there is no way for the poker client to know if a button is pressed by your hardware or by the virtual machine api
For virtualbox, you can use putMouseEventAbsolute for mouse simulation and putScancode for keyboard simulation


Whatever the chosen solution, you may want to move your mouse and click like human:
- don't click the same pixel, even if the center of the button have more chance to be cicked than pixel in border of the button. (openholdem is using a Gaussian equation)
-  maybe the mouse moement should be as human as possible. (no teleportation, don't follow a mathematical straight line
 - wait some random time before 2 pressed buttons
- etc ...


  1. Awesome blog. I enjoyed reading your articles. This is truly a great read for me. I have bookmarked it and I am looking forward to reading new articles.Keep up the good work! http://roulette-gamedownload

  2. Unlike the spambot above me, I really did enjoy your article. Unfortunately VMware doesn't seem to have equivalent keyboard/mouse input.