HWND hWnd = ::FindWindow(NULL, _T("XXXXX"));
if(NULL == hWnd)
{
return ;
}
HWND hWndStatusBar = ::FindWindowEx(hWnd, NULL, _T("msctls_statusbar32"), NULL);
if(NULL == hWndStatusBar)
{
return ;
}
DWORD dwProcessId = 0;
GetWindowThreadProcessId(hWnd, &dwProcessId);
HANDLE hProcess = OpenProcess(PROCESS_VM_OPERATION | PROCESS_VM_READ | PROCESS_VM_WRITE, FALSE, dwProcessId);
if(NULL == hProcess)
{
return ;
}
LRESULT nCount = ::SendMessage(hWndStatusBar, SB_GETPARTS, 0, 0);
LPVOID pBuf = VirtualAllocEx(hProcess, NULL, MAX_PATH, MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE);
if(NULL != pBuf)
{
TCHAR buf[MAX_PATH] = {0};
DWORD dwRead = 0;
for(int i=0; i<(int)nCount; i++)
{
::SendMessage(hWndStatusBar, SB_GETTEXT, i, (LPARAM)pBuf);
if(ReadProcessMemory(hProcess, pBuf, buf, sizeof(buf), &dwRead))
{
AfxMessageBox(buf);
}
}
VirtualFreeEx(hProcess, pBuf, 0, MEM_RELEASE);
}
CloseHandle(hProcess);
获取其它进程窗口中的状态栏信息(FindWindowEx GetWindowThreadProcessId OpenProcess SendMessage轮番轰炸)
,