I have an application that pops up a modal dialog box during a long calculation. This dialog box is supposed to show the progress during the calculation. this works fine so long as the user does not drag another window over the window, however if they do then the window redraws do not seem to work (or if another window covers this window then is minimized it does not seem to redraw the window either!)

Below is a snippet of the code i am using

CCalcualtionDialog:oCalculation()
{
for(i=0;i<quadrangearray.GetSize();i=i+2)
{
// Do Calcuation

// Attempt to update window
progressdlg.m_progresstext.Format("Done Iteration %d, i);
progressdlg.m_progresstext3 = "";
progressdlg.UpdateData(FALSE);
progressdlg.UpdateWindow();
progressdlg.ShowWindow(SW_SHOW);

}
}

If anyone knows how to force the update so it works correctly can you help me