works:programmer:cpp:wowantiafk
Программка Antiafk для WoW
Нажимает пробел во всех окнах World of Warcraft.
#pragma hdrstop #pragma argsused #include <tchar.h> #include <stdio.h> #include <windows.h> #define WND_FIND_BUFFSZ 1024 // - BOOL CALLBACK EnumWindowsProc(HWND hwnd,LPARAM lParam); int _tmain(int argc, _TCHAR* argv[]) { SetConsoleTitle(TEXT("Simple NoAFK for WOW by Eugene")); int tick = 0; do { EnumWindows((WNDENUMPROC) EnumWindowsProc, tick++); Sleep(60000); } while ( true ); return 0; // то знает как Warning убрать??? W8066 Unreachable code } BOOL CALLBACK EnumWindowsProc(HWND hWnd, LPARAM lParam) { wchar_t* wndclass = (wchar_t*) calloc(WND_FIND_BUFFSZ, sizeof(wchar_t)); wchar_t* wndtitle = (wchar_t*) calloc(WND_FIND_BUFFSZ, sizeof(wchar_t)); __try { GetClassNameW(hWnd, wndclass, WND_FIND_BUFFSZ-1); GetWindowTextW(hWnd, wndtitle, WND_FIND_BUFFSZ-1); if ((0 == wcscmp(wndclass, L"GxWindowClassD3d")) && (0 == wcscmp(wndtitle, L"World of Warcraft"))) { wprintf(L"Sending SPACE key to %s (%.8x) tick=%d\n", wndtitle, hWnd, lParam); SendMessage(hWnd, WM_KEYDOWN, (WPARAM) VK_SPACE, NULL); Sleep(500); SendMessage(hWnd, WM_KEYUP, (WPARAM) VK_SPACE, NULL); } } __finally { free(wndclass); free(wndtitle); } return TRUE; }
Проект для C++ Builder XE5 : wowantiafk.zip
works/programmer/cpp/wowantiafk.txt · Последнее изменение: 2018/12/15 17:18 — 127.0.0.1