How to read status Bar text for another application in MFC?

Posted on 2007-09-28
Medium Priority
Last Modified: 2013-12-14
I would like to find out how to read the Status Bar text of a running application.
Question by:xewoox
1 Comment
LVL 12

Accepted Solution

OnegaZhang earned 2000 total points
ID: 19983107
You need to use SB_GETTEXT message, but the memory must be allocated in target process.
A code snippet can be found in http://www.codeproject.com/threads/int64_memsteal.asp?df=100&forumid=29535&exp=0&select=1604427#xx1604427xx
//HWND hwnd=FindWindow(NULL, "Status Bar in a Dialog - Nish for CP");
//HWND hStatusBar=FindWindowEx(hwnd, NULL, "msctls_statusbar32", NULL);
HWND hwnd=FindWindow(NULL, "TEST");
HWND hStatusBar=FindWindowEx(hwnd, NULL, "StatusBar20WndClass", NULL);
unsigned long pid;
HANDLE process;
char *_item;
char item[512];
GetWindowThreadProcessId(hStatusBar, &pid);
_item=(char*)VirtualAllocEx(process, NULL, 512, MEM_COMMIT, PAGE_READWRITE);
SendMessage(hStatusBar, SB_GETTEXT, (WPARAM)0, (LPARAM)_item);
ReadProcessMemory(process, _item, &item, 512, NULL);
VirtualFreeEx(process, _item, 0, MEM_RELEASE);
return 0;

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.
Suggested Courses

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question