Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Updating RichEdits

Status
Not open for further replies.

cyprus106

Programmer
Apr 30, 2001
654
I have an application that runs several threads. On the main form, I have a RichEdit. Every time a certain event occurs in one of the threads, it sends a message to the main form and from there ive got:
RichEdit->Lines->Add("data");
RichEdit->Lines->Add("more data");
The problem is that often times several events will fire off at once and they all send messages to the main form. It will start the function, and add the first line, "data", but then restart the function for the other thread, without adding the second line. Is there any way I can tell the threads to wait, or do something like make the RichEdit be updating so it has to finish... any ideas?

Thanks, Cyprus
 
Have you looked at WaitForSingleObject? James P. Cottingham

I am the Unknown lead by the Unknowing.
I have done so much with so little
for so long that they think I am now
qualified to do anything with nothing.
 
I tried it, it's not quite what I'm needing. Cyprus
 
In case you haven't noticed, I'm [machinegun] in the dark, here. Have you used Synchronize? James P. Cottingham

I am the Unknown lead by the Unknowing.
I have done so much with so little
for so long that they think I am now
qualified to do anything with nothing.
 
its not a problem with the threads, at least i don think so. It's that the same function gets called 3 times at once and so it only gets so far before it just returns and restarts in the middle of its procedure.. Cyprus
 
I have read about "protected" and it could do the trick, look in the help, i can't remember exatly and the beer has done some work on me...
 
Maby updating the RichEdit field in a critical section or a mutual exclusion will help you.

CU Stummel
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top