#include <iostream>
#include <Windows.h>
#include <chrono>
#include <thread>
static void action() {
HWND main = FindWindow(NULL, L"clumsy 0.3");
if (main == NULL) {
printf("MAIN IS NULL\n");
return;
}
HWND filt = FindWindowEx(main, 0, 0, L"Filtering");
if (filt == NULL) {
printf("FILT IS NULL\n");
return;
}
HWND buttonHandle = FindWindowEx(filt, 0, L"Button", L"Start");
if (buttonHandle == NULL) {
printf("BUTTONHANDLE IS NULL\n");
return;
}
printf("BUTTON IS PRESSING\n");
SendMessage(buttonHandle, BN_CLICKED, 0, 0);
printf("BUTTON IS PRESSED\n");
}
int main()
{
bool lastKeyIsPressed = false;
while (true)
{
Sleep(50);
if ((GetKeyState(VK_LMENU) & 0x8000)) {
if (!lastKeyIsPressed) {
action();
lastKeyIsPressed = true;
}
}
else
{
lastKeyIsPressed = false;
}
}
}
никаких ошибок, просто ничего не происходит