Here's what I'm working with.
#include <windows.h>
#include "iostream"
void SendText(char* message, int size)
{
int lc=0;
do{
keybd_event(VkKeyScan(message[lc]),0,KEYEVENTF_EXTENDEDKEY,0);
keybd_event(VkKeyScan(message[lc]),0,KEYEVENTF_KEYUP,0);
lc=lc+1;
}
while(lc<size);
keybd_event(VK_RETURN,0,KEYEVENTF_EXTENDEDKEY,0); //Presses Return
keybd_event(VK_RETURN,0,KEYEVENTF_KEYUP,0); //Presses Return
}
int main()
{
Sleep(5000);
char a=98;
SendText("a", strlen("a"));
}
I think this is a noobish question but, how would I get it to type out whatever is stored in the variable "a" when using the function SendText. I know it has something to do with inserting the variable into the parameters but I can't seem to figure out what I need to do to get it to spit out the ASCII character stored in "a" (98=b in this case)...
Everything I try to do gives me issues because the ASCII codes don't match up at all with virtual key codes
What I'm trying to do is start the program, pause so I can select an input box in another program, then cycle through a bunch of ASCII characters and press enter after each one. But I can't really start working on the cycling through characters part untill I figure out how to send them properly in the first place. Maybe there's a better way, I'm open to suggestions.
my example output would be, for instance:
Start program
during 5 second wait I select the input box in a different window
5 seconds ends and the program enters:
1
Enter
2
Enter
3
Enter
...
999
Enter
and so on