MFC线程使用

来源:互联网 发布:淘宝包邮标签怎么设置 编辑:程序博客网 时间:2024/06/05 09:46
在BCB6中编译MFC线程方法:
unsigned int __cdecl ThreadFun(LPVOID lpParam){    TForm1 * p = (TForm1*)lpParam;    int i=0;    while(1)    {        i++;        CTime time = CTime::GetCurrentTime();        CString szTime = time.Format("%H:%M:%S");        p->Caption =szTime.GetBuffer(szTime.GetLength());        Sleep(1000);        if(i>=5)          break;    }    return 0;}void __fastcall TForm1::Button7Click(TObject *Sender){    pThread = AfxBeginThread(ThreadFun,this);}

原创粉丝点击