Solved

CStatusBar.

Posted on 1998-03-07
2
238 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

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 …
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

911 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

16 Experts available now in Live!

Get 1:1 Help Now