WorkerThread + ProgressDlg
-
Hi, I have a worker thread for some file processing, the status of which I wanna display on a Progress dialog. I took advantage of the built in progress dialog in Add To Project/Components and Controls. I create and manipulate the Progress dlg in the worker thread using the pointer to CProgressDlg passed from AfxBeginThread's 2 parameter to the worker thread. Problem: the Progress dialog has very slow responsiveness to buttonclicks as if there were no threads involved at all. What's wrong? Thanks Bunburry
-
Hi, I have a worker thread for some file processing, the status of which I wanna display on a Progress dialog. I took advantage of the built in progress dialog in Add To Project/Components and Controls. I create and manipulate the Progress dlg in the worker thread using the pointer to CProgressDlg passed from AfxBeginThread's 2 parameter to the worker thread. Problem: the Progress dialog has very slow responsiveness to buttonclicks as if there were no threads involved at all. What's wrong? Thanks Bunburry
Each thread should have it's own message loop. Maybe your implementation does not? Todd Smith CPUA 0x007 ... shaken not stirred
-
Each thread should have it's own message loop. Maybe your implementation does not? Todd Smith CPUA 0x007 ... shaken not stirred
the built-in progress dialog has its own message pump which is automatically called by every StepIt or SetPos.
ASSERT(m\_hWnd!=NULL); MSG msg; // Handle dialog messages while(PeekMessage(&msg, NULL, 0, 0, PM\_REMOVE)) { if(!IsDialogMessage(&msg)) { TranslateMessage(&msg); DispatchMessage(&msg); } }
This is meant... Bunburry
-
the built-in progress dialog has its own message pump which is automatically called by every StepIt or SetPos.
ASSERT(m\_hWnd!=NULL); MSG msg; // Handle dialog messages while(PeekMessage(&msg, NULL, 0, 0, PM\_REMOVE)) { if(!IsDialogMessage(&msg)) { TranslateMessage(&msg); DispatchMessage(&msg); } }
This is meant... Bunburry
Case solved. I will always remember to call
if (pProgressDlg->CheckCancelButton)
pProgressDlg->DestroyWindow();in the loop of my worker thread. Thanks anyway for your help. Bunburry