#include <iostream>
#include <Windows.h>
#include "conio.h"
using namespace std;
int main(){
HWND windowHandle = FindWindow(0, ("Battlefield 3™"));
INPUT *key;
if(windowHandle == NULL){
cout << "Didn't Found The Game..." << endl;
_getch();
}
else{
cout << "Autopressing W";
SetForegroundWindow(windowHandle);
Sleep(1000);
key = new INPUT;
key->type = INPUT_KEYBOARD;
key->ki.time = 0;
key->ki.wScan = 0;
key->ki.dwExtraInfo = 0;
while(true){
if(GetAsyncKeyState(VK_F5)){
exit(0);
}
key->ki.wVk = 0x51;
key->ki.dwFlags = 0;
SendInput(1,key,sizeof(INPUT));
Sleep(1000);
}
_getch();
}
}
