Hi.
I created a little program in C which is using the keybd_event() and GetAsyncKeyState() function.
The purpose is to create an autowalk macro for a game. The program works perfect on the desktop.
However, if I try to use it in the game (which runs in fullscreen), my program won't work. I guess that's because my program is somehow blocked by the game (maybe because it's demanding all resources, I am not sure why).
How can I make sure my program will work anyway?
I'd be thankful for hints!
Thanks,
moccajoghurt
edit: here's the code:
Code:
#include <stdio.h>
#include <Windows.h>
int main(void) {
printf("autowalk started. press \"num\" to start and stop.\n");
int pressed = 0;
int walk = 0;
while (1) {
if (GetAsyncKeyState(144) != 0 && pressed == 0) {
pressed = 1;
if (walk == 0) {
walk = 1;
} else {
walk = 0;
}
} else if (GetAsyncKeyState(144) == 0 && pressed == 1) {
pressed = 0;
}
if (walk == 1) {
keybd_event(87,0,0,0);
}
Sleep(10);
}
}