应该是很基础的东西了,以前没学好:( 现在补起来:)
#include <windows.h>
int main()
{
HWND hWnd = FindWindow(NULL,"Target"); //获取窗口的HWND
DWORD pid;
GetWindowThreadProcessId(hWnd,&pid); //根据窗口HWND获取进程ID
HANDLE h = OpenProcess(PROCESS_ALL_ACCESS,FALSE,pid); //根据进程ID获取进程句柄
int data = 11111;
WriteProcessMemory(h,
(PVOID)0x12fed0,&data,4,NULL); //0x12fed0为被修改的数据的地址
CloseHandle(h);
return 0;
}