Click here to Skip to main content
15,887,746 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: How to create a Floating Image over another Image ? Pin
Cool_Dev12-Jan-11 1:23
Cool_Dev12-Jan-11 1:23 
GeneralRe: How to create a Floating Image over another Image ? Pin
002comp12-Jan-11 1:52
002comp12-Jan-11 1:52 
GeneralRe: How to create a Floating Image over another Image ? Pin
Cool_Dev12-Jan-11 2:22
Cool_Dev12-Jan-11 2:22 
QuestionGet Document IDispatch in native C++ (possibly using MFC ActiveX Control) [modified] Pin
T210211-Jan-11 21:37
T210211-Jan-11 21:37 
Questionhelp on control update from worker thread Pin
ashwani_gupt11-Jan-11 21:07
ashwani_gupt11-Jan-11 21:07 
AnswerRe: help on control update from worker thread Pin
Cedric Moonen11-Jan-11 21:13
Cedric Moonen11-Jan-11 21:13 
GeneralRe: help on control update from worker thread Pin
ashwani_gupt11-Jan-11 21:31
ashwani_gupt11-Jan-11 21:31 
AnswerRe: help on control update from worker thread Pin
Andrew Brock11-Jan-11 21:21
Andrew Brock11-Jan-11 21:21 
I would guess it is 1 of 2 problems.
1. Most likely that they belong to a different thread (the main thread). To my knowledge, UpdateData must be called from the thread that owns the controls.
2. The controls haven't been created yet, if it is in initialisation code.

The best way I would suggest for fixing problem 1 would be to register a custom message WM_USER + 1 and have the handler call UpdateData like this:

header file:
#define CM_UPDATEDATA WM_USER + 1

class CScada_thrdsView : public BaseClass {
	//functions and variables
	protected:
		afx_msg LRESULT OnUpdateData(WPARAM wParam, LPARAM lParam); //Add this in with your other message handlers
}


source file:
BEGIN_MESSAGE_MAP(CScada_thrdsView, BaseClass)
	//all your other message handlers
	ON_MESSAGE(CM_UPDATEDATA , OnUpdateData)
END_MESSAGE_MAP()

//wParam is bSaveAndValidate parameter to UpdateData()
LRESULT CScada_thrdsView::OnUpdateData(WPARAM wParam, LPARAM lParam) {
	UpdateData((BOOL)wParam);
	return 0;
}


in the thread:
void CScada_thrdsView::dsp_cnt() {
	while (!exit_thrd) {
		while(!nw_cnt);
		sprintf(cstring,"%d",count);
		m_val.InsertString((count-1),cstring);
		PostMessage(CM_UPDATEDATA, FALSE); //This calls UpdateData(FALSE) in the main thread
		nw_cnt = 0;
	} 
}

GeneralRe: help on control update from worker thread Pin
ashwani_gupt11-Jan-11 21:33
ashwani_gupt11-Jan-11 21:33 
GeneralRe: help on control update from worker thread Pin
ashwani_gupt11-Jan-11 21:47
ashwani_gupt11-Jan-11 21:47 
GeneralRe: help on control update from worker thread Pin
Andrew Brock11-Jan-11 21:54
Andrew Brock11-Jan-11 21:54 
GeneralRe: help on control update from worker thread Pin
ashwani_gupt12-Jan-11 2:23
ashwani_gupt12-Jan-11 2:23 
QuestionMeasure CRichEditCtrl height Pin
Pavel Sokolov11-Jan-11 8:00
Pavel Sokolov11-Jan-11 8:00 
AnswerRe: Measure CRichEditCtrl height Pin
User 742933811-Jan-11 8:41
professionalUser 742933811-Jan-11 8:41 
GeneralRe: Measure CRichEditCtrl height Pin
Pavel Sokolov11-Jan-11 10:04
Pavel Sokolov11-Jan-11 10:04 
AnswerRe: Measure CRichEditCtrl height Pin
User 742933811-Jan-11 10:14
professionalUser 742933811-Jan-11 10:14 
GeneralRe: Measure CRichEditCtrl height Pin
Pavel Sokolov11-Jan-11 10:43
Pavel Sokolov11-Jan-11 10:43 
QuestionRe: Measure CRichEditCtrl height Pin
User 742933811-Jan-11 10:45
professionalUser 742933811-Jan-11 10:45 
AnswerRe: Measure CRichEditCtrl height Pin
Pavel Sokolov11-Jan-11 11:02
Pavel Sokolov11-Jan-11 11:02 
AnswerRe: Measure CRichEditCtrl height Pin
Pavel Sokolov11-Jan-11 11:39
Pavel Sokolov11-Jan-11 11:39 
QuestionRe: Measure CRichEditCtrl height Pin
David Crow11-Jan-11 9:08
David Crow11-Jan-11 9:08 
AnswerRe: Measure CRichEditCtrl height Pin
Pavel Sokolov11-Jan-11 10:07
Pavel Sokolov11-Jan-11 10:07 
GeneralRe: Measure CRichEditCtrl height Pin
Nikolay Denisov18-Feb-11 22:27
Nikolay Denisov18-Feb-11 22:27 
GeneralRe: Measure CRichEditCtrl height Pin
Pavel Sokolov18-Feb-11 22:41
Pavel Sokolov18-Feb-11 22:41 
GeneralRe: Measure CRichEditCtrl height Pin
Nikolay Denisov18-Feb-11 23:02
Nikolay Denisov18-Feb-11 23:02 

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.