progress window threads
-
-
I have application in which I need to show a progress window frm a worker thread. create another thread for the progress window and launch the dialog. Now I need to change the status text on the progress dilog. I try sendmessage, but that doesn't work.
-
I have application in which I need to show a progress window frm a worker thread. create another thread for the progress window and launch the dialog. Now I need to change the status text on the progress dilog. I try sendmessage, but that doesn't work.
ThisIsMeRon wrote:
I have application in which I need to show a progress window frm a worker thread
Worker thread probably will be busy with some other processing so it's always better to run the progress GUI in different UI thread(Which is able to process the UI messages). Sharing the MFC Window handle (CWnd or it's derivatives) objects across thread is not safe. So pass the HWND of progress bar UI (Dialog, control or whatsoever) and you can simply Post/Send message using this handle. If you've properly mapped the message in the destination window, it will surely receive it. Please try to post snippets from your code.
-Sarath. "Great hopes make everything great possible" - Benjamin Franklin
My blog - Sharing My Thoughts
-
I have application in which I need to show a progress window frm a worker thread. create another thread for the progress window and launch the dialog. Now I need to change the status text on the progress dilog. I try sendmessage, but that doesn't work.
You should create the progress window in the main UI thread and send/post messages to it from the worker thread, really. Just don't send too many messages. Probably posting is better, otherwise the worker thread is going to wait for the progress message to be processed, which rather defeats the object of having a separate worker thread!
-
You should create the progress window in the main UI thread and send/post messages to it from the worker thread, really. Just don't send too many messages. Probably posting is better, otherwise the worker thread is going to wait for the progress message to be processed, which rather defeats the object of having a separate worker thread!
-
I have application in which I need to show a progress window frm a worker thread. create another thread for the progress window and launch the dialog. Now I need to change the status text on the progress dilog. I try sendmessage, but that doesn't work.
ThisIsMeRon wrote:
I have application in which I need to show a progress window frm a worker thread.
Not a good idea. The UI component should be owned by the primary thread. The secondary (i.e., worker) thread should post messages to the primary thread indicating the progress. It's all explained in more detail here.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch