MFC 获取内存返回值的问题
const LPCWSTR gameCaption = _T("QQ游戏 - 连连看角色版");
void CMFCApplication3Dlg::OnBnClickedButton2()
{
// TODO: 在此添加控件通知处理程序代码
//1. FindWindow获取窗口句柄
HWND gameh=::FindWindow(NULL, gameCaption);
//2. GetWindowThreadProcessId通过句柄获得窗口进程ID
DWORD processid;
::GetWindowThreadProcessId(gameh,&processid);
//3.打开指定进程
HANDLE processH = ::OpenProcess(PROCESS_ALL_ACCESS,false, processid);
//4.读取内存的数据
SIZE_T * byread = NULL; // 实际读取的大小
LPCVOID pbase = (LPCVOID)"0x00181608"; //基址 ==> 0x00181608
LPVOIDnbuffer = (LPVOID)&m_num;// 返回的值
::ReadProcessMemory(processH, pbase,nbuffer,4, byread);
//this->m_num =UINT(nbuffer);
UpdateData(false);
}
这样写出来nbuffer 没有值 是空的 //刚开始学 求大神教一教 自己顶一顶
const LPCWSTR gameCaption = _T("QQ游戏 - 连连看角色版");
void CMFCApplication3Dlg::OnBnClickedButton2()
{
// TODO: 在此添加控件通知处理程序代码
//1. FindWindow获取窗口句柄
HWND gameh=::FindWindow(NULL, gameCaption);
//2. GetWindowThreadProcessId通过句柄获得窗口进程ID
DWORD processid;
::GetWindowThreadProcessId(gameh,&processid);
//3.打开指定进程
HANDLE processH = ::OpenProcess(PROCESS_ALL_ACCESS,false, processid);
//4.读取内存的数据
SIZE_T * byread = NULL; // 实际读取的大小
LPCVOID pbase = (LPCVOID)"0x00181608"; //基址 ==> 0x00181608
LPVOIDnbuffer = (LPVOID)&m_num;// 返回的值
::ReadProcessMemory(processH, pbase,nbuffer,4, byread);
//this->m_num =UINT(nbuffer);
UpdateData(false);
}
processid是有值的 不知道是什么地方错了 {:1_930:} 有没有大佬啊 先自己顶一下
粗心的错 再见 {:1_906:}
保存地址
const LPCWSTR gameCaption = _T("QQ游戏 - 连连看角色版");void CMFCApplication3Dlg::OnBnClickedButton2()
{
// TODO: 在此添加控件通知处理程序代码
//1. FindWindow获取窗口句柄
HWND gameh=::FindWindow(NULL, gameCaption);
//2. GetWindowThreadProcessId通过句柄获得窗口进程ID
DWORD processid;
::GetWindowThreadProcessId(gameh,&processid);
//3.打开指定进程
HANDLE processH = ::OpenProcess(PROCESS_ALL_ACCESS,false, processid);
//4.读取内存的数据
SIZE_T * byread = NULL; // 实际读取的大小
LPCVOID pbase = (LPCVOID)"0x00181608"; //基址 ==> 0x00181608
BYTE m_num={0};
LPVOIDnbuffer = (LPVOID)&m_num;// 返回的值
::ReadProcessMemory(processH, pbase,nbuffer,4, byread);
//this->m_num =UINT(nbuffer);
UpdateData(false);
}
页:
[1]