I cannot seem to get this to work. How do I use this (or should I be
using SendInput() ) to send keystrokes to Iapplications/games? I know
I need to use a getfocus function. For instance, I could use
keybd_event() to send virtual keys to a game, but I cannot get it to
work. Here is a snipplet that I am trying to get it to only type a
letter on the screen. Can anybody see a problem? Thanks in advance.
#include <windows.h>
#include <iostream>
using namespace std;
void AltEnter(void);
int main()
{
Sleep(2000);
AltEnter();
Sleep(5000);
cout << "\nEnter 1 to end: ";
int number = 0;
while (number != 1) {
cin >> number;
}
return 0;
}
void AltEnter()
{
keybd_event(49,
0,
0,
0);
keybd_event(49,
0,
KEYEVENTF_KEYUP,
0);
return;
}