?
Solved

CStatusBar.

Posted on 1998-03-07
2
Medium Priority
?
243 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 32

Accepted Solution

by:
jhance earned 400 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

Get MongoDB database support online, now!

At Percona’s web store you can order your MongoDB database support needs in minutes. No hassles, no fuss, just pick and click. Pay online with a credit card. Handle your MongoDB database support now!

Question has a verified solution.

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

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
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 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.
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Suggested Courses

770 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