获取其它进程窗口中的状态栏信息(FindWindowEx GetWindowThreadProcessId OpenProcess SendMessage轮番轰炸)
Posted 朝闻道
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了获取其它进程窗口中的状态栏信息(FindWindowEx GetWindowThreadProcessId OpenProcess SendMessage轮番轰炸)相关的知识,希望对你有一定的参考价值。
- 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
以上是关于获取其它进程窗口中的状态栏信息(FindWindowEx GetWindowThreadProcessId OpenProcess SendMessage轮番轰炸)的主要内容,如果未能解决你的问题,请参考以下文章
linux应用中,在一个进程内如何获取本进程内其它线程的堆栈信息、
linux应用中,在一个进程内如何获取本进程内其它线程的堆栈信息、