Click here to Skip to main content
15,912,897 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralGDI+ Pin
CuongVT13-May-04 23:36
CuongVT13-May-04 23:36 
GeneralVS.NET Classwizard Pin
RChin13-May-04 22:50
RChin13-May-04 22:50 
GeneralRe: VS.NET Classwizard Pin
Maxwell Chen13-May-04 22:54
Maxwell Chen13-May-04 22:54 
GeneralRe: VS.NET Classwizard Pin
RChin13-May-04 22:59
RChin13-May-04 22:59 
GeneralRe: VS.NET Classwizard Pin
Anthony_Yio14-May-04 1:26
Anthony_Yio14-May-04 1:26 
GeneralTurning off Runtime checks in VC7 Pin
Anonymous13-May-04 22:10
Anonymous13-May-04 22:10 
GeneralRe: Turning off Runtime checks in VC7 Pin
Anthony_Yio14-May-04 1:57
Anthony_Yio14-May-04 1:57 
GeneralMain MFC and its Threads Pin
sweep12313-May-04 22:00
sweep12313-May-04 22:00 
I have an MFC application which creates a thread to receive a stream of data from another application in bursts.

Now the thread is started by the main MFC program via:-
m_DisplayTextThread = ::AfxBeginThread(CTestGUI1Dlg::DisplayTextThread, (LPVOID) &m_DisplayThreadData);
and passed the pointer (this) of the main MFC application in the structure m_DisplayThreadData in order for it to access the methods/properties of the main MFC application that require updating.

This causes an Assertion fault, and it was suggested (in a previous post) that PostThreadMessage be used to communicate from the thread to the main application.

My question is - what is the scheme to use for this type of activity, where the GUI needs to reflect data received, but when the receive processing is done in a different thread.

How would this be done? I have looked up PostThreadMessage but dont see how to use it.

I have tended to pass into the thread the neccessary data/pointer the thread required, but this time I have problems.
If I use a smple timer in place of the thread all is well, but have to run slow to ensure that I do not loose data.

GeneralRe: Main MFC and its Threads Pin
jmkhael13-May-04 23:23
jmkhael13-May-04 23:23 
GeneralRe: Main MFC and its Threads Pin
sweep12314-May-04 0:26
sweep12314-May-04 0:26 
GeneralRe: Main MFC and its Threads Pin
Jitendra gangwar14-May-04 0:47
Jitendra gangwar14-May-04 0:47 
GeneralRe: Main MFC and its Threads Pin
Roger Stoltz14-May-04 1:30
Roger Stoltz14-May-04 1:30 
GeneralRe: Main MFC and its Threads Pin
sweep12314-May-04 2:02
sweep12314-May-04 2:02 
GeneralRe: Main MFC and its Threads Pin
Roger Stoltz14-May-04 3:38
Roger Stoltz14-May-04 3:38 
GeneralRe: Main MFC and its Threads Pin
Grahamfff14-May-04 11:39
Grahamfff14-May-04 11:39 
GeneralRe: Main MFC and its Threads Pin
Roger Stoltz16-May-04 13:13
Roger Stoltz16-May-04 13:13 
GeneralRe: Main MFC and its Threads Pin
sweep12317-May-04 2:00
sweep12317-May-04 2:00 
QuestionHow to use Amazon Web Services.. Pin
Sumit Kapoor13-May-04 21:56
Sumit Kapoor13-May-04 21:56 
AnswerRe: How to use Amazon Web Services.. Pin
Anthony_Yio14-May-04 1:46
Anthony_Yio14-May-04 1:46 
GeneralCListCtrl and CImageList question Pin
DaFrawg13-May-04 21:52
DaFrawg13-May-04 21:52 
GeneralRe: CListCtrl and CImageList question Pin
DaFrawg23-May-04 22:43
DaFrawg23-May-04 22:43 
Questionwhich Project type to use? Pin
frumm13-May-04 21:48
frumm13-May-04 21:48 
AnswerRe: which Project type to use? Pin
Maxwell Chen13-May-04 21:54
Maxwell Chen13-May-04 21:54 
AnswerRe: which Project type to use? Pin
Cedric Moonen13-May-04 23:01
Cedric Moonen13-May-04 23:01 
AnswerRe: which Project type to use? Pin
hasansheik14-May-04 0:18
hasansheik14-May-04 0:18 

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.