そこに書かれているように (^)、C++ と WriteProcessMemory() に問題があります。Windows-Calc.exe を開き、数値を保存して CheatEngine を開きました。番号を見つけて(変更など)、このプログラムに入れました:(注:私はドイツ人です。「Rechner」は「Calculator」と同じです)
#include <iostream>
#include <Windows.h>
using namespace std;
int main (){
int Value = 500;
HWND hWnd = FindWindow(0, L"Rechner");
if (!hWnd) {
cerr << "Can't find window" << endl;
return 0;
}
DWORD PID;
GetWindowThreadProcessId(hWnd, &PID);
HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, PID);
if (!hProcess) {
cerr << "Process handle error" << endl;
return 0;
}
int iSuccess = WriteProcessMemory(hProcess, (LPVOID)0x899FC6F60C , &Value, (DWORD)sizeof(Value), NULL);
int i = 0;
while (iSuccess == 0){
i = i+1;
cerr << "Failed " << i << " Error: " << GetLastError() << endl;
iSuccess = WriteProcessMemory(hProcess, (LPVOID)0x899FC6F60C , &Value, (DWORD)sizeof(Value), NULL); //Here all begins
}
clog << "Done" << endl;
CloseHandle(hProcess);
return 0;
}
Window got found, Process got found (エラーはありません..) しかし、"//Here all begin" 行は 0 を返し、GetLastError() を 487 に設定します。以下のすべてと同様です。私が間違ったことを知っているなら、初心者向けに説明してください。私は昨日 C++ を始めました。