Solved

CStatusBar.

Posted on 1998-03-07
2
237 Views
Last Modified: 2013-11-20
Hi,
I have a CStatusBar object that I am trying to update from a thread. The CStatusBar object is
a public member of my CMainWnd, and I am trying to update it with Cwnd::SetWindowText. I
tried SetPaneText, but that didn't work either. In fact, the only time it did work was when I had
a debugging messagebox showing, and so the paint message was being processed. I tried
sending the paint message manually with ::SendMessage, but that didn't work either. Does
anybody know what is the problem?
Thanks,
Eoin.
0
Comment
Question by:estronge
2 Comments
 
LVL 32

Accepted Solution

by:
jhance earned 100 total points
ID: 1316817
Call your worker thread with the handle to the main window:

AfxBeginThread(DoSomething, this->m_hWnd);

Then your worker thread has something to update:

// Worker process to do something
UINT DoSomething(LPVOID pParam)
{
      HWND hWnd = (HWND)pParam;

      ::SetDlgItemText(hWnd, IDC_STATUSBAR, "Yo!");
      return 0;    // thread completed successfully}
}
0
 

Author Comment

by:estronge
ID: 1316818
Great!!! Thanks. It didn't quite work, as I was already passing a configuration structure through
the LPVOID pParam, but you set me on the right track, I used:
::SetDlgItemText( AfxGetMainWnd() ->m_hWnd, IDC_STATUSBAR, "My Text");

Thanks again.
Eoin.

0

Featured Post

Free Trending Threat Insights Every Day

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.

Join & Write a Comment

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 (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

747 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

12 Experts available now in Live!

Get 1:1 Help Now