: Hey I need some help. Using Borland C++Builder 6
:
: I just programmed a sort of autotyper. I tell the program what to
: type then I activate it and it'll start typing that.
:
: My problem is that the program works fine for example notepad or
: msword but doesn't work when playing some games.
:
: Currently I'm using the code
:
: keybd_event(90,0,0,0);
:
:
: My program was made to simulate keypresses so it should be exactly
: the same as pressing the keyboard. The game responds to presses on
: the keyboard but not to my program, why?
:
: Is there a diffrence between using "keybd_event(90,0,0,0);" and
: actually pressing a key on the keyboard?
:
: Im trying to simulate the letter "z" value equals 90
:
: Also I have a Saitek P990 joypad plugged in that can "simulate"
: keypresses. Why can't my program do the same?
There are 3 different kinds of keyboard events: key_down, key_up, and key_pressed. Most games use the first 2 to store the keyboard state and then allow the game loop to perform the necessary actions. This is because then they can detect how long you're holding the key instead of just knowing that you pressed it. The keybd_event() might generate the last 1 (ie key_pressed). Since games don't necessarily watch for that event, it goes by unnoticed.