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

C / C++ / MFC

 
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 
GeneralRe: Accessing the statusbar in a worker thread problem Pin
Diddy4-Feb-04 2:36
Diddy4-Feb-04 2:36 
I suspect your CStatusBar is doing a sanaty check and your blowing up in a ASSERT_VALID(this) call somewhere in CStatusBar. One of the things MFC classes often do is check for themselvs in handle maps when you call various mathods on them - the long and short of it is not all MFC classes can be passed around between threads in this way, and there is nothing you can do about it directly.

what you have to do is to use messages to communicate between the threads.

Declare a custom message:

#define WM_CHANGESBTEXT WM_USER+0x400

Add a hander for it to your dialog:

class CMyDialog:
{
LRESULT OnChangeSBText(WPARAM, LPARAM);

.
.
.
};

Wire up the message map:

BEGIN_MESSAGE_MAP(CMyDialog...)
ON_MESSAGE(WM_CHANGESBTEXT, OnChangeSBText)
...

Then implment the method:

LRESULT CMyDialog::OnChangeSBText(WPARAM wp, LPARAM)
{
LPCTSTR pszText = (LPCTSTR)wp;
m_statusbar.SetPaneText(0, pszText );
ChangeStatusText(pszText);
return 0;
}

Then in the thread, rather than do it directly, just send a message to the main dialog

UINT doPrintingProc(LPVOID param)
{
LPCTSTR pszString = "Testing";
AfxGetMainWnd()->SendMessage(WM_CHANGESBTEXT, pszString);
}

Dont forget to use Send (not post) message if your string can go out of scope.

}
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 
Questionhow to print to a specific tray of a printer Pin
asawari3-Feb-04 11:36
asawari3-Feb-04 11:36 

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.