Home > Net >  Vc create MFC procedures, click the button to add data to the list box
Vc create MFC procedures, click the button to add data to the list box

Time:09-21

 void CMFCThirdMutilThreadDlg: : OnBnClickedButtonAdd () 
{

Cstrings strText;
Long shuMu=1;
DWORD t1=GetTickCount ();//before the procedures section system running time (ms)
M_lst_demo. SetRedraw (false);
While (shuMu & lt; {
=5000)StrText. The 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);
Cstrings temp_value=https://bbs.csdn.net/topics/_T (" ");//temp_value used to handle the int value
Temp_value. The Format (_T (" % d "), the GetTickCount () - t1);//fixed format
AfxMessageBox (temp_value + "ms");
}

The above code can perform, but the effect is not good, should not be heard in the OnBnClickedButtonAdd write cycle, with a thread, but I don't know how to write, who help me to write the last attached code, thank you!
  • Related