⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 progress.cpp

📁 The project demonstrates many Windows common controls, including the extensive use of image lists. T
💻 CPP
字号:
// progress.cpp : implementation file
//

#include "stdafx.h"
#include "doodads.h"
#include "progress.h"

#ifdef _DEBUG
#undef THIS_FILE
static char BASED_CODE THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CProgressDialog dialog


CProgressDialog::CProgressDialog(CWnd* pParent /*=NULL*/)
	: CDialog(CProgressDialog::IDD, pParent)
{
	//{{AFX_DATA_INIT(CProgressDialog)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT

	m_bRunning = FALSE;
	m_nCount = 0;
}


void CProgressDialog::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CProgressDialog)
		// NOTE: the ClassWizard will add DDX and DDV calls here
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CProgressDialog, CDialog)
	//{{AFX_MSG_MAP(CProgressDialog)
	ON_WM_TIMER()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()


/////////////////////////////////////////////////////////////////////////////
// CProgressDialog message handlers

#define IDT_TIMER	998

void CProgressDialog::OnOK() 
{
	m_bRunning = SetTimer(IDT_TIMER, 500, NULL);
	if (m_bRunning)
	{
		m_nCount = 0;
		GetDlgItem(IDOK)->EnableWindow(FALSE);
	}
}

void CProgressDialog::OnTimer(UINT nIDEvent) 
{
	m_nCount++;
	CProgressCtrl* pProgress = (CProgressCtrl*) GetDlgItem(IDC_PROGRESS);
	ASSERT(pProgress != NULL);
	pProgress->StepIt();

	if (m_nCount == 90)
	{
		KillTimer(IDT_TIMER);
		m_bRunning = FALSE;
		GetDlgItem(IDOK)->EnableWindow(TRUE);
	}
}

BOOL CProgressDialog::OnInitDialog() 
{
	CDialog::OnInitDialog();
	CProgressCtrl* pProgress = (CProgressCtrl*) GetDlgItem(IDC_PROGRESS);
	ASSERT(pProgress != NULL);

	pProgress->SetRange(0, 90);
	pProgress->SetStep(1);
		
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -