Click here to Skip to main content
15,914,905 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralC++ Exception Handling Pin
IceBerG7112-May-04 5:41
IceBerG7112-May-04 5:41 
GeneralRe: C++ Exception Handling Pin
David Crow12-May-04 6:36
David Crow12-May-04 6:36 
GeneralRe: C++ Exception Handling Pin
IceBerG7112-May-04 15:30
IceBerG7112-May-04 15:30 
GeneralRe: C++ Exception Handling Pin
Joe Woodbury12-May-04 7:08
professionalJoe Woodbury12-May-04 7:08 
GeneralRe: C++ Exception Handling Pin
Paul Ranson12-May-04 13:11
Paul Ranson12-May-04 13:11 
GeneralEvents and Shared Memory Pin
sweep12312-May-04 4:57
sweep12312-May-04 4:57 
GeneralRe: Events and Shared Memory Pin
Joe Woodbury12-May-04 6:58
professionalJoe Woodbury12-May-04 6:58 
GeneralRe: Events and Shared Memory Pin
Grahamfff12-May-04 9:56
Grahamfff12-May-04 9:56 
Thanks for your comments on the code.

All I am trying to do is have an Edit Box (Multi-line, vertical scroll) display text posted via a call to DLL. The thread handles the Event from the DLL but needed access to the dialogs classes.

I don't like how you pass the pointer of the dlg into the thread; it seems awfully convoluted. Why not just pass the this pointer as the param?
That why I pass in the dialog pointer (this) and the stop flag.
The structure is as follows:-
// For Display Text Thread
typedef struct
{
bool stopFlag; // Set if some error occured during the process or want to terminate
CTestGUI1Dlg* _this;
}DisplayThreadData;

The second potential problem is pxDlg->UpdateOutput(). This is the most likely candidate for a memory overwrite of your m_pMsg pointer.

Whats the alternative, as if I comment this call out, program does not crash (but does not display the text. I think you are right, this is where the problem is!!!
But what to do?

A few other concern: You may be handling CTestGUI1Dlg incorrectly. You should use PostThreadMessage to do more than trivial things in a CWnd derived object from a secondary thread.

Sorry you have passed the limit of my knowledge.

I was using a timer to process the text display, but had to slow things down (on both size) to be sure of not losing data.

Was advised that reacting to events would be better.

But ended up with a different problem.

Have now set Event to Auto reset and sorted out the terminate logic.

Sweep123 working from home.

grahamfff
GeneralRe: Events and Shared Memory Pin
Joe Woodbury12-May-04 10:23
professionalJoe Woodbury12-May-04 10:23 
QuestionWhere can I find some article about technique of VC++ IDE? Pin
bloggs197412-May-04 4:47
bloggs197412-May-04 4:47 
AnswerRe: Where can I find some article about technique of VC++ IDE? Pin
jmkhael12-May-04 4:54
jmkhael12-May-04 4:54 
GeneralThank you, it is. Do anyone has more? Pin
bloggs197412-May-04 8:42
bloggs197412-May-04 8:42 
GeneralMJPEG question Pin
cristane12-May-04 4:45
cristane12-May-04 4:45 
GeneralRe: MJPEG question Pin
Chris Losinger12-May-04 4:59
professionalChris Losinger12-May-04 4:59 
GeneralHelp for mschart problem! Pin
allen_homer12-May-04 4:35
allen_homer12-May-04 4:35 
GeneralConversion from integer to string Pin
jazzlycool12-May-04 4:08
jazzlycool12-May-04 4:08 
GeneralRe: Conversion from integer to string Pin
jmkhael12-May-04 4:14
jmkhael12-May-04 4:14 
GeneralRe: Conversion from integer to string Pin
bikram singh12-May-04 4:25
bikram singh12-May-04 4:25 
GeneralRe: Conversion from integer to string Pin
jazzlycool12-May-04 4:56
jazzlycool12-May-04 4:56 
GeneralRe: Conversion from integer to string Pin
Rafael Fernández López12-May-04 11:04
Rafael Fernández López12-May-04 11:04 
GeneralisValidDoubleValue(double *) Pin
Tibor Blazko12-May-04 3:58
Tibor Blazko12-May-04 3:58 
GeneralRe: isValidDoubleValue(double *) Pin
jmkhael12-May-04 4:20
jmkhael12-May-04 4:20 
GeneralRe: isValidDoubleValue(double *) Pin
Tibor Blazko12-May-04 4:22
Tibor Blazko12-May-04 4:22 
GeneralRe: isValidDoubleValue(double *) Pin
jmkhael12-May-04 4:28
jmkhael12-May-04 4:28 
GeneralRe: isValidDoubleValue(double *) Pin
Tibor Blazko12-May-04 4:39
Tibor Blazko12-May-04 4:39 

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.