本文共 493 字,大约阅读时间需要 1 分钟。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | void __cdecl ThreadFun( LPVOID lpParam) { CTestDlg * p = (CTestDlg*)lpParam; int i=0; while (1) { i++; CTime time = CTime::GetCurrentTime(); CString szTime = time .Format( "%H:%M:%S" ); p->SetWindowText(szTime.GetBuffer(szTime.GetLength())); Sleep(1000); if (i>=50) break ; } } void CTestDlg::OnBnClickedButton7() { _beginthread(ThreadFun,0, this ); } |
VC2010编译运行
本文转自Chinayu201451CTO博客,原文链接:http://blog.51cto.com/9233403/1970695 ,如需转载请自行联系原作者