::承接外挂4::
a、编程读出棋盘数据
b、棋盘数据显示出来
1 void CFewDlg::OnButton3() 2 { 3 int chessdata[3][3];//a[y][x] 4 5 HWND gameh=::FindWindow(NULL,"井字棋");//获取窗口句柄 6 //获取窗口进程ID 7 DWORD processid; 8 ::GetWindowThreadProcessId(gameh,&processid); 9 HANDLE processH=::OpenProcess(PROCESS_ALL_ACCESS,false,processid);//打开指定进程10 11 //读指定进程 内存数据12 DWORD byread;13 LPCVOID pbase=(LPCVOID)0x00B0507C; //棋盘数据基址14 LPVOID nbuffer=(LPVOID)&chessdata; //存放棋盘数据15 ::ReadProcessMemory(processH,pbase,nbuffer,3*3*4,&byread);//进程句柄|基址|存放数据缓冲区|要读取数据的字节数|实际读取的字节数16 17 char buf[10]; ///显示棋盘数据18 m_chessdata=""; //先清空编辑19 for (int y=0;y<=2;y++)//一列一列的读20 {21 for(int x=0;x<=2;x++) //一行一行的读22 {23 itoa(chessdata[y][x],buf,16); //itoa整型转换成字串24 m_chessdata+=buf;25 m_chessdata+=" ";26 }27 m_chessdata+=" || "; //换行28 }29 UpdateData(false); //更新数据30 }