Skip to content

Instantly share code, notes, and snippets.

@zenden2k
Created September 6, 2015 12:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zenden2k/3d577f72627fe2430940 to your computer and use it in GitHub Desktop.
Save zenden2k/3d577f72627fe2430940 to your computer and use it in GitHub Desktop.
#include <windows.h>
#include <Commctrl.h>
int main(int argc, char* argv[])
{
DWORD dwProcessID;
SIZE_T nNumberOfBytesRead;
HWND window = (HWND)0x4b0cb6;
GetWindowThreadProcessId((HWND)window, &dwProcessID);
HANDLE hProcess = OpenProcess(PROCESS_VM_OPERATION | PROCESS_VM_READ | PROCESS_VM_WRITE, false, dwProcessID);
void* Pointer = VirtualAllocEx(hProcess, NULL, 4096, MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE);
RECT bi;
SendMessage((HWND)window, TB_GETITEMRECT, 1 /* индекс кнопки*/, (LPARAM)Pointer);
ReadProcessMemory(hProcess, (Pointer), &bi, sizeof(bi), &nNumberOfBytesRead);
PostMessage((HWND)window, WM_LBUTTONDOWN, NULL, MAKELPARAM(bi.left, bi.top));
PostMessage((HWND)window, WM_LBUTTONUP, NULL, MAKELPARAM(bi.left, bi.top));
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment