首页 > 代码库 > c++builder XE6 线程
c++builder XE6 线程
class TSleepFunc : public TCppInterfacedObject<TProc>{public: TSleepFunc(TForm28* Form) : FForm(Form) { } virtual void __fastcall Invoke(void) { for (FForm->ClientDataSet1->First(); !FForm->ClientDataSet1->Eof; FForm->ClientDataSet1->Next()) { FForm->ClientDataSet1->Edit(); FForm->ClientDataSet1->FieldByName("Stat")->Value = http://www.mamicode.com/FForm->ClientDataSet1->RecNo; FForm->ClientDataSet1->Post(); } TThread::Synchronize(TThread::CurrentThread, UpdateCaption); } void __fastcall UpdateCaption(void) { FForm->Caption = "OK"; }private: TForm28* FForm;};// ---------------------------------------------------------------------------void __fastcall TForm28::Button1Click(TObject *Sender){ ClientDataSet1->Close(); ADOQuery1->Close(); ADOQuery1->SQL->Text = "select * from brda"; ADOQuery1->Open(); ClientDataSet1->Open(); TThread::CreateAnonymousThread(new TSleepFunc(this))->Start();}
c++builder XE6 线程
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。