I have CDialog based modal dialog that invokes a fairly lengthy processing step using the following call:
Thr=AfxBeginThread(MyFunction, pPam, THREAD_PRIORITY_LOWEST);
The thread starts up and runs nicely to completion. However I have a CProgressCtrl on the invoking modal dialog that I want to update while the lengthy process is happening.
I have a timer set in the dialog that calls me every 100 ms. At that time I attempt to set the progress bar using SetPos(). The problem I have is that I have to call Sleep() in the spawned thread in order to give the dialog a chance to update the progress bar.
I would have thought that the dialog would have gotten some cycles especially when I used THREAD_PRIORITY_LOWEST for the spawned thread.
Is the main thread expected to get no cycles unless the spawned thread does some sleeping?
I'm running on a reasonable machine (Intel i5).