代码:
#include "stdafx.h"
#include <windows.h>
#include <iostream>
#include <iomanip>
#include <locale>
#include <sstream>
#include <string>
int main()
{
HWND handle = FindWindow(0 ,TEXT("window name"));
if(handle == 0)
{
MessageBox(0,TEXT("Failed to find window"),TEXT("Return"),MB_OK);
}
else
{
DWORD ID;
GetWindowThreadProcessId(handle,&ID);
HANDLE hProcess = OpenProcess(PROCESS_VM_WRITE|PROCESS_VM_OPERATION , FALSE, ID);
hProcess = OpenProcess(PROCESS_VM_READ , FALSE, ID);
if(!hProcess)
{
Beep(1000,1000);
}else {
int buffer;
if (ReadProcessMemory(hProcess,(void *)0x00963FC4,&buffer,4,NULL))
{
printf(buffer);
}
else {
MessageBox(0,TEXT("Could not Read"),TEXT("Return"),MB_OK);
}
}CloseHandle(hProcess);
}
}
我试图
让这个程序读取内存地址,
但我得到了这个错误:
IntelliSense
:“int”类型的参数与“const char *”类型的参数不兼容
不行。
字符串测试;