5a4 Subj : Re: Return value from worker thred when the working thread must be suspend after calculation??? To : comp.os.ms-windows.programmer.win32,microsoft.public.vc.language,comp.programming.threads From : Alexander Grigoriev Date : Mon Aug 29 2005 11:14 pm You should not access windows of the main thread from the secondary thread. This may lead to deadlocks. Use PostMessage to communicate between threads. "David W. Poole, Jr." wrote in message news:crp7h11qb1l3te1ufgljakv0fomofutjbj@4ax.com... > On 29 Aug 2005 16:16:10 -0700, pattreeya@gmail.com was understood to > have stated the following: > >>Hello, >> >> it will be a very kind of you if someone can help me with the >>following problem. >> >> >> After finish calling "Calculate" function, I would like >>to send the result to the main thread and suspend the working thread. >>how can i get the the return value from this threadproc to be used by >>the main thread? > > For what it matters, whenever I have a thread that updates part of the > UI, I create the thread with a structure that contains a handle to the > dialog box or parent window I wish to update. When the need to update > the UI is encountered by the thread, it either updates the control(s) > directly, or sends a WM_APP to the window with an appropriate > structure containing the value(s) for the windproc() to use to update > the controls. > > . 0