在对话框上加个进度条控件IDC_PROGRESS1,在其C**Dlg类里加入变量int m_nProgress;
void CMy0Dlg::OnButton1() //按钮响应函数,开始记时
{
m_nProgress=0;//初始进度条为0
CProgressCtrl *pProg=(CProgressCtrl*)GetDlgItem(IDC_PROGRESS1);
pProg->SetRange (0,100);//设定进度条范围为0-70
for(int i=0;i<100;i++)
{
int n=0;
while(n++<5000000);
m_nProgress+=1;//进度加1
pProg->SetPos (m_nProgress);
}
}