1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
|
#include <cstdlib>
#include <iostream>
#include <windows.h>
#include <stdio.h>
void SendKey (char Vk)
{
char VkKey = VkKeyScan(Vk);
keybd_event(VK_SHIFT, 0, 0, 0);
keybd_event(VkKey, 0, 0, 0);
keybd_event(VK_SHIFT, 0, KEYEVENTF_KEYUP, 0);
keybd_event(VkKey, 0, KEYEVENTF_KEYUP, 0);
}
using namespace std;
int main(int argc, char *argv[])
{
FILE * pFile;
char myString[100];
_sleep(3000);
pFile = fopen("test.txt", "r+");
if(pFile == NULL) perror("Error opening File");
else {
while(!feof(pFile)) {
fgets(myString, 100, pFile);
for(int i = 0; i < sizeof myString; i++) {
SendKey(myString[i]);
}
keybd_event(VK_RETURN,0,0,0);
keybd_event(VK_RETURN,0, KEYEVENTF_KEYUP, 0);
_sleep(1000);
}
}
system("PAUSE");
return EXIT_SUCCESS;
}
|