const PCHAR gameCaption="QQ游戏 - 连连看角色版";
byte chessdata[11][19];//a[y][x]
void CLlkwgDlg::OnButton1()
{
// TODO: Add your control notification handler code here
//获取窗口句柄
HWND gameh=::FindWindow(NULL,gameCaption);
//获取窗口进程ID
DWORD processid;
::GetWindowThreadProcessId(gameh,&processid);
//打开指定进程
HANDLE processH=::OpenProcess(PROCESS_ALL_ACCESS,FALSE,processid);
//读指定进程 内存数据
DWORD byread;
LPCVOID pbase;
pbase=(LPCVOID)0x0012A1F8;//棋盘数据基址
LPVOID nbuffer=(LPVOID)byread;//存放棋盘数据
::ReadProcessMemory(processH,pbase,nbuffer,11*19,&byread);
char buf;
m_chessdata="";
for(int y=0;y<11;y++)
{
for(int x=0;x<19;x++)
{
itoa(chessdata[y][x],&buf,16);//转换成字串
m_chessdata+=buf;
m_chessdata+=" ";
}
m_chessdata+="\r\n";
}
UpdateData(FALSE);
}
显示出来的全是0 而不是棋盘数据 搞了2天还没有明白游戏
byte chessdata[11][19];//a[y][x]
void CLlkwgDlg::OnButton1()
{
// TODO: Add your control notification handler code here
//获取窗口句柄
HWND gameh=::FindWindow(NULL,gameCaption);
//获取窗口进程ID
DWORD processid;
::GetWindowThreadProcessId(gameh,&processid);
//打开指定进程
HANDLE processH=::OpenProcess(PROCESS_ALL_ACCESS,FALSE,processid);
//读指定进程 内存数据
DWORD byread;
LPCVOID pbase;
pbase=(LPCVOID)0x0012A1F8;//棋盘数据基址
LPVOID nbuffer=(LPVOID)byread;//存放棋盘数据
::ReadProcessMemory(processH,pbase,nbuffer,11*19,&byread);
char buf;
m_chessdata="";
for(int y=0;y<11;y++)
{
for(int x=0;x<19;x++)
{
itoa(chessdata[y][x],&buf,16);//转换成字串
m_chessdata+=buf;
m_chessdata+=" ";
}
m_chessdata+="\r\n";
}
UpdateData(FALSE);
}
显示出来的全是0 而不是棋盘数据 搞了2天还没有明白游戏
解决方案 »
- ID_YES undeclared identifier????
- 投递 WSARecv 时,返回错误,WSAGetLastError() 得到6,是 INVALID SOCKET HANDLE!?
- 请教怎样才能得到 MsAgent 的动作指令表 ?
- 怎样启动一个新的线程,运行一个com.
- FTP服务器测试,免费开放FTP,欢迎上传下载。
- 如何编程用USB摄像头抓取并保存一副图片?
- PCTSTR VC6说不认识,求助。
- 求助多线程的一个简单问题
- 今天面试后让我不知道路在何方
- VC++问题
- 为什么用VS建立MFC单文档应用程序假如access数据库后。刚建好就编译会有一大堆错
- QQ连连看无法以读内存数据 请大大帮忙看看哪里出错了
If the function succeeds, the return value is nonzero.If the function fails, the return value is 0 (zero). To get extended error information, call GetLastError. The function fails if the requested read operation crosses into an area of the process that is inaccessible.调用系统API要检查返回值