7,540
社区成员
发帖
与我相关
我的任务
分享
void CMFCThirdMutilThreadDlg::OnBnClickedButtonAdd()
{
CString strText;
long shuMu=1;
DWORD t1 = GetTickCount();//程序段开始前取得系统运行时间(ms)
m_lst_demo.SetRedraw(false);
while (shuMu <= 5000) {
strText.Format(_T("%ld"), shuMu);
m_lst_demo.AddString(strText);//strText
m_lst_demo.SetCurSel(m_lst_demo.GetCount() - 1);
shuMu++;
}
m_lst_demo.SetRedraw(true);
CString temp_value = _T(""); //temp_value用来处理int值
temp_value.Format(_T("%d"), GetTickCount()- t1);//固定格式
AfxMessageBox(temp_value+" 毫秒");
}