如何在MFC应用程序中制作无限不确定进度条?
这是我的源代码,但它不是我想要的无限进度条。
这是我的源代码,但它不是我想要的无限进度条。
WaitProcessDlg::WaitProcessDlg(CWnd* pParent /*=NULL*/)
: CDialogEx(WaitProcessDlg::IDD, pParent)
{
}
void WaitProcessDlg::DoDataExchange(CDataExchange* pDX)
{
CDialogEx::DoDataExchange(pDX);
DDX_Control(pDX, IDC_PROGRESS1, m_Progress);
}
BEGIN_MESSAGE_MAP(WaitProcessDlg, CDialogEx)
ON_WM_TIMER()
END_MESSAGE_MAP()
BOOL WaitProcessDlg::OnInitDialog()
{
CDialogEx::OnInitDialog();
str = pApp->GetProfileString(_T("Process"), _T("Process"));
if(tempHWND = ::FindWindow(NULL, str)){
EndDialog( 0 );
}else{
CMFCRibbonProgressBar* pProgressBar = new CMFCRibbonProgressBar(IDC_PROGRESS1, pProgressBar);
pProgressBar->SetInfiniteMode(m_bInfiniteProgressMode);
pProgressBar->SetRange(0, 200);
pProgressBar->SetPos(200, true);
m_Progress.SetInfiniteMode(m_bInfiniteProgressMode);
m_Progress.SetRange(0, 100);
SetTimer(IDC_PROGRESS1, 0, NULL);
}
return TRUE;
}
void WaitProcessDlg::OnTimer(UINT nIDEvent)
{
while (m_Progress.GetPos() != 100){
if (tempHWND = ::FindWindow(NULL, str)){
EndDialog(0);
KillTimer(IDC_PROGRESS1);
}
m_Progress.OffsetPos(1);
}
while (m_Progress.GetPos() != 0){
if (tempHWND = ::FindWindow(NULL, str)){
EndDialog(0);
KillTimer(IDC_PROGRESS1);
}
m_Progress.OffsetPos(-1);
}
CDialog::OnTimer(nIDEvent);
}
我需要一些示例或说明,如何在MFC上创建一个不确定进度条,就像这样: 进度条