关于 EnumChildWindows函数问题
昨夜冷雨 2011-07-16 05:59:54 下面是我的代码
有时程序运行到
::Sleep(3500);
EnumChildWindows(h, (WNDENUMPROC)MyEnumProc, 0);
::Sleep(3000);
这段时线程就会停止
是什么原因呢
//---------------------------------------------------------------------------
// Important: Methods and properties of objects in VCL can only be
// used in a method called using Synchronize, for example:
//
// Synchronize(UpdateCaption);
//
// where UpdateCaption could look like:
//
// void __fastcall simu::UpdateCaption()
// {
// Form1->Caption = "Updated in a thread";
// }
//---------------------------------------------------------------------------
__fastcall simu::simu(bool CreateSuspended)
: TThread(CreateSuspended)
{
}
//---------------------------------------------------------------------------
void __fastcall simu::Execute()
{
int s;
double c;
AnsiString a;
;
c=(StrToInt(Form1->Edit1->Text)-Form1->d)/5;
c= RoundTo(c,0);
a=c;
s=0;
// F//orm1->ListBox1->Items->Add(IntToStr(Form1->d)) ;
//str="lala";
//Synchronize((TThreadMethod)List) ;
while(s<5)
{
Form1->pl=Form1->Edit1->Text+"MHz";
if(Simulation_mouse(c))
{
break;
}
::Sleep(3500);
s++;
}
//---- Place thread code here ----
}
//---------------------------------------------------------------------------