Solved

CStatusBar.

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

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

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

Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
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.
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…

773 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