C++读取读取进程以及相关内存内容,获取游戏血量和真气

#include

#include
#include

using namespace std;

int main() {

    HWND win = FindWindowA("QElementClient Window", "Element Client");

    //获取进程
    DWORD GamePid=9444;

    //HANDLE gameProcess= ::OpenProcess(PROCESS_VM_READ | PROCESS_VM_WRITE, false, GamePid);
    HANDLE gameProcess= ::OpenProcess(PROCESS_VM_READ , false, GamePid);
    

    DWORD bood,power;
    LPDWORD readByte=NULL;


    long bloodAdress = 0x00DEE530,powerAdress ;

    ReadProcessMemory(gameProcess, (LPVOID)(bloodAdress) , &bood, 4,readByte);
    

 

powerAdress = 0x15B1E884; 
    //15B1E884

    ReadProcessMemory(gameProcess, (LPVOID)(bloodAdress-4) , &power, 4,readByte);

    ReadProcessMemory(gameProcess, (LPVOID)(bloodAdress), &power, 4, readByte);

    //HWND win = FindWindowA("TXGuiFoundation", "QQ");

    if (win == NULL) {
        cout << "窗口失效"<

 

你可能感兴趣的:(C++程序设计,窗口,内存)