void__cdeclThreadFun(LPVOIDlpParam){CTestDlg*p=(CTestDlg*)lpParam;inti=0;while(1){i++;CTimetime=CTime::GetCurrentTime();CStringszTime=time.Format("%H:%M:%S");p->SetWindowText(szTime.GetBuffer(szTime.GetLength()));Sleep(1000);if(i>=50)break;}}voidCTestDlg::OnBnClickedButton7(){_beginthread(ThreadFun,0,this);}

VC2010编译运行