Click here to Skip to main content
15,888,816 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Generalcpu info Pin
r i s h a b h s3-Feb-04 20:02
r i s h a b h s3-Feb-04 20:02 
GeneralRe: cpu info Pin
Jijo.Raj3-Feb-04 21:53
Jijo.Raj3-Feb-04 21:53 
GeneralRe: cpu info Pin
Alexander M.,4-Feb-04 3:11
Alexander M.,4-Feb-04 3:11 
GeneralDoubt ! TAB Messages from child dialog is not going to child dialogs message queue! Pin
Ilamparithi3-Feb-04 19:23
Ilamparithi3-Feb-04 19:23 
GeneralRe: Doubt ! TAB Messages from child dialog is not going to child dialogs message queue! Pin
Diddy4-Feb-04 2:26
Diddy4-Feb-04 2:26 
GeneralMultiple doc/view pairs Pin
flip3-Feb-04 19:23
flip3-Feb-04 19:23 
GeneralRe: Multiple doc/view pairs Pin
Roger Allen4-Feb-04 2:22
Roger Allen4-Feb-04 2:22 
GeneralAccessing the statusbar in a worker thread problem Pin
J.B.3-Feb-04 19:15
J.B.3-Feb-04 19:15 
Hello guys,
I am having this problem to access (more specifically, to change text) the statusbar directly or indirectly in a MFC worker thread of my dialogue-based application.
The status bar was firstly created in my main dialogue class' OnInitDialog().
m_statusbar.Create(this);	/* Create the status bar */
m_statusbar.SetIndicators(indicators, 2);	/* Set number of the pane */ 
m_statusbar.GetStatusBarCtrl().SetBkColor(RGB(180,180,180));	/* Set background colour */
m_statusbar.SetPaneText(0, "Offline");	/* Set initial status text */
SetTimer(100, 1000, NULL);	/* Add the clock */

The m_statusbar is a CStatusBar type member in the class declaration.
CStatusBar m_statusbar;

As I need to change the text in some functions in other classes and threads, I tried to make the statusbar accessible globally by having
pStatusBar = &m_statusbar;

also in the OnInitDialog, where CStatusBar *pStatusBar is declared as a global variable.

While there was no problem with compilation, but I'd encounter assertion error if I try to use pStatusBar to change text of the statusbar in the thread function, whether directly or indirectly (uses the change statusbar text function in other class), examples below:
UINT doPrintingProc(LPVOID param)
{
        COtherDlg *ptr = (COtherDlg *)param;

	pStatusBar->SetPaneText(0, "Testing");
	ptr->ChangeStatusText("Testing");
}

I use the similiar way to manipulate the globally accessible CListView and CEdit text box, all seem to have no problem.

Would appreciate if someone could point out where I have done wrong.
GeneralRe: Accessing the statusbar in a worker thread problem Pin
Diddy4-Feb-04 2:36
Diddy4-Feb-04 2:36 
GeneralRe: Accessing the statusbar in a worker thread problem Pin
J.B.6-Feb-04 5:05
J.B.6-Feb-04 5:05 
GeneralRe: Accessing the statusbar in a worker thread problem Pin
Diddy8-Feb-04 9:18
Diddy8-Feb-04 9:18 
GeneralRe: Accessing the statusbar in a worker thread problem Pin
J.B.8-Feb-04 13:54
J.B.8-Feb-04 13:54 
GeneralWeb View Pin
Prakash Nadar3-Feb-04 18:20
Prakash Nadar3-Feb-04 18:20 
GeneralPLZ help me on web server stuff Pin
laurentz_wei3-Feb-04 15:33
laurentz_wei3-Feb-04 15:33 
GeneralRe: PLZ help me on web server stuff Pin
Christian Graus3-Feb-04 17:51
protectorChristian Graus3-Feb-04 17:51 
GeneralRe: PLZ help me on web server stuff Pin
laurentz_wei3-Feb-04 18:48
laurentz_wei3-Feb-04 18:48 
Questionhow should RegisterHotKey() be used? Pin
Zephyr1233-Feb-04 14:50
sussZephyr1233-Feb-04 14:50 
AnswerRe: how should RegisterHotKey() be used? Pin
Antti Keskinen3-Feb-04 18:23
Antti Keskinen3-Feb-04 18:23 
GeneralRe: how should RegisterHotKey() be used? Pin
zephyr1233-Feb-04 18:43
susszephyr1233-Feb-04 18:43 
GeneralStatus Of Object. Pin
kimsangwoo3-Feb-04 13:19
kimsangwoo3-Feb-04 13:19 
GeneralRe: Status Of Object. Pin
Christian Graus3-Feb-04 17:49
protectorChristian Graus3-Feb-04 17:49 
GeneralRe: Status Of Object. Pin
kimsangwoo3-Feb-04 19:16
kimsangwoo3-Feb-04 19:16 
GeneralRe: Status Of Object. Pin
Steve S3-Feb-04 22:58
Steve S3-Feb-04 22:58 
GeneralSerial project in Visual C++ problem Pin
rmnowick3-Feb-04 12:32
rmnowick3-Feb-04 12:32 
GeneralRe: Serial project in Visual C++ problem Pin
rmnowick4-Feb-04 8:42
rmnowick4-Feb-04 8:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.