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

Posted on 2007-09-28
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

    You need to use SB_GETTEXT message, but the memory must be allocated in target process.
    A code snippet can be found in
    //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;

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Security Threats Are You Missing?

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
    Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
    This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
    The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.

    779 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

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now