// CDialogProgress.cpp: 实现文件 // #include "pch.h" #include "MTerm2.h" #include "DialogProgress.h" #include "afxdialogex.h" // CDialogProgress 对话框 IMPLEMENT_DYNAMIC(CDialogProgress, CDialogEx) CDialogProgress::CDialogProgress(CWnd* pParent /*=nullptr*/) : CDialogEx(IDD_DIALOG_PROGRESS, pParent) { } CDialogProgress::~CDialogProgress() { } void CDialogProgress::DoDataExchange(CDataExchange* pDX) { CDialogEx::DoDataExchange(pDX); DDX_Control(pDX, IDC_PROGRESS1, m_progress1); } BEGIN_MESSAGE_MAP(CDialogProgress, CDialogEx) ON_WM_TIMER() END_MESSAGE_MAP() // CDialogProgress 消息处理程序 BOOL CDialogProgress::OnInitDialog() { CDialogEx::OnInitDialog(); // TODO: 在此添加额外的初始化 this->SetWindowText(m_TitleStr); GetDlgItem(IDC_STATIC_HINT)->SetWindowText(m_HintStr); m_progress1.SetRange(0, 100); // m_progress1.SetRange32(0, 99); SetTimer(1, 100, NULL); return TRUE; // return TRUE unless you set the focus to a control // 异常: OCX 属性页应返回 FALSE } void CDialogProgress::OnTimer(UINT_PTR nIDEvent) { // TODO: 在此添加消息处理程序代码和/或调用默认值 if (nIDEvent == 0){ } else if (nIDEvent == 1) { if (m_bAutoPos) { m_nPreogress++; } // m_progress1.SetPos(m_nPreogress); //if (m_nPreogress == 100) { // this->OnCancel(); //} } CDialogEx::OnTimer(nIDEvent); } int CDialogProgress::SetPos(int nPos) { // TODO: 在此处添加实现代码. m_nPreogress = nPos; m_progress1.SetPos(nPos); return 0; } int CDialogProgress::SetTitle(CString sTitleStr) { // TODO: 在此处添加实现代码. m_TitleStr = sTitleStr; this->SetWindowText(m_TitleStr); return 0; } int CDialogProgress::SetHintStr(CString sHintStr) { // TODO: 在此处添加实现代码. m_HintStr = sHintStr; GetDlgItem(IDC_STATIC_HINT)->SetWindowText(m_HintStr); return 0; }