Article ID: 142202
Article Last Modified on 11/21/2006
/* Compile options needed: default
*/
// This is a menu option handler that takes a long period of time
void CMainFrame::OnLengthyProcess()
{
// Create the CProgressCtrl as a child of the status bar positioned
// over the first pane.
RECT rc;
m_wndStatusBar.GetItemRect (0, &rc);
CProgressCtrl wndProgress;
VERIFY (wndProgress.Create(WS_CHILD | WS_VISIBLE, rc,
&m_wndStatusBar, 1));
wndProgress.SetRange(0, 50);
wndProgress.SetStep(1);
// Perform some lengthy process, simulated here with a for loop
// and the Sleep function.
for(int i=0;i<50;i++)
{
Sleep(50);
wndProgress.StepIt();
}
}
Keywords: kbinfo kbhowto kbmfcctrlbar kbstatbar kbuidesign KB142202