进度条题目。。就帮忙。。
如图所示为编程一个基于对话框程序界面,其中进度条已经定义了一个变量m_Progress,并且添加了“开始”按钮的响应函数OnStart()和WM_TIMER的消息响应函数:OnTimer(UINT nIDEvent).为实现如下功能,试编写相应程序代码。1、 软件起动后,将进度条的范围设置成0到200,步长设成1,起始位置在0位;
2、 按开始按钮后,进度条位置值开始逐渐增加,20秒后过度条到达满值,然后停止。
3、 再次按开始按钮,动作重复
BOOLCTestDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// Add "About..." menu item tosystem menu.
// IDM_ABOUTBOX must be in the systemcommand range.
ASSERT((IDM_ABOUTBOX & 0xFFF0) ==IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
CString strAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING,IDM_ABOUTBOX, strAboutMenu);
}
}
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
//TODO: Add extra initialization here
return TRUE; // return TRUE unless you set the focus to a control
}
void CTestDlg::OnStart()
{
// TODO: Add your control notificationhandler code here
voidCTestDlg::OnTimer(UINT nIDEvent)
{
// TODO: Add your message handler code hereand/or call default
CDialog::OnTimer(nIDEvent);
}