13,825
社区成员
发帖
与我相关
我的任务
分享
//?????????????????????
//What?
//.H
public: // User declarations
__fastcall TForm1(TComponent* Owner);
bool TestRun(int a,AnsiString str);
bool bTest;
//.CPP
//---------------------------------------------------------------------------
bool TForm1::TestRun(int a,AnsiString str)
{
if (a==1) {
return true;
}
return false;
}
void __fastcall TForm1::Button2Click(TObject *Sender)
{
// bTest = TestRun(1,"ydlchina"); //遮蔽掉
CTestThread * test = new CTestThread(false);
}
//thread
void __fastcall CTestThread::Execute()
{
//---- Place thread code here ----
Form1->bTest= Form1->TestRun(1,"ydlchina"); //跑这儿来了
if(Form1->bTest)
{
Form1->Edit1->Text = "ydlchina提示你OK了";
}
}
//不明白你的意思,不过还是给你做个示范,不过这只是一种,他和使用其它单元没什么两样,不过你要注意没有Handle
//主程序
public: // User declarations
__fastcall TForm1(TComponent* Owner);
bool TestRun(int a,AnsiString str);
bool bTest;//不一定非要这么用
bool TForm1::TestRun(int a,AnsiString str)
{
if (a==1) {
return true;
}
return false;
}
void __fastcall TForm1::Button2Click(TObject *Sender)
{
bTest = TestRun(1,"ydlchina");
CTestThread * test = new CTestThread(false);
}
//线程
void __fastcall CTestThread::Execute()
{
//---- Place thread code here ----
if(Form1->bTest)//注意别忘#include这个所在的头文件
{
Form1->Edit1->Text = "ydlchina提示你OK了";
}
}
//只是一个实例