c++ ProgressBar基本使用

void CPBTestDlg::OnBnClickedBtnStart()
{
	// TODO: 在此添加控件通知处理程序代码
	const int nMaxValue = 10000;
	CString str;
	m_pg.SetRange(0, nMaxValue);
	/*for (size_t i = 0; i < nMaxValue; i++)
	{
		m_pg.SetPos(i);
		str.Format(_T("%d"), i);
		m_st.SetWindowText(str);
	}*/

	m_pg.SetStep(5);
	while (1)
	{
		m_pg.StepIt();
		str.Format(_T("%d"), m_pg.GetPos());
		m_st.SetWindowTextW(str);
		if (m_pg.GetPos()==nMaxValue)
		{
			break;
		}
	}
	
	AfxMessageBox(_T("耗时工作运行结束"));
}

猜你喜欢

转载自blog.csdn.net/dxm809/article/details/114432485