RichEdit member variable woes
-
In my project I've got a RichEdit box, with a mapped member variable t_Display. I've created a thread that waits for some input (in this case from a socket) and then tries to add this data to the RichEdit box. I am getting an assert error and I have no idea why. Could anyone help me? The code I'm using is thus: char msg[MAXMSGLEN]; while (fConnected) { sock.Recv(msg, MAXMSGLEN); UpdateData(true); t_Display.Format("%s%s\r\n", (LPCSTR)t_Display, msg); UpdateData(false); } - X 'Reality is the only obstacle to happiness'
-
In my project I've got a RichEdit box, with a mapped member variable t_Display. I've created a thread that waits for some input (in this case from a socket) and then tries to add this data to the RichEdit box. I am getting an assert error and I have no idea why. Could anyone help me? The code I'm using is thus: char msg[MAXMSGLEN]; while (fConnected) { sock.Recv(msg, MAXMSGLEN); UpdateData(true); t_Display.Format("%s%s\r\n", (LPCSTR)t_Display, msg); UpdateData(false); } - X 'Reality is the only obstacle to happiness'
I assume the UpdateData() call is asserting. You can't pass or access CWnd objects between threads. You'll need to use API-level code to update the edit control from your secondary thread. --Mike-- http://home.inreach.com/mdunn/ While I can't be correct on all matters, I can make the reassuring claim that where I am inaccurate, I am at least definitively inaccurate. :love: your :bob: with :vegemite: and :beer: Sonork - 100.10414 AcidHelm