Note: I am using WTL, not MFC. I can understand MFC code but I would prefer a WTL or pure Windows answer.
I've got a long processing loop in my application and I would like to display a progress dialog while it's doing its stuff.
Here's the code simplified:
FlushMessages(); /* message pump */
if (dlg.m_bCancel) * set to true if the cancel button is pressed */
/* do work here and loop again */
Now this works fine, the code executes, the dialog is displayed nicely, but this dialog is a child of my main window and I would like to lock the main window until the work is completed, e.g. I would like the focus to stay on the dialog.
Note: I don't want it System modal, just application modal.
How should I change the code? I don't see how to use the DoModal since I need to run code and just update the progress window once in a while.