[CPP]View PlainCopy
- 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);
http://blog.csdn.net/visualeleven/article/details/7286517
Get status bar information in other process windows (FindWindowEx GetWindowThreadProcessId openprocess SendMessage rounds of bombing)