R
ray_xie156
Unregistered / Unconfirmed
GUEST, unregistred user!
void __fastcall TMainfrm::BitBtnStartClick(TObject *Sender)
{
//
BitBtnStart->Enabled = false;
Mainfrm->BitBtnClose->Enabled = false;
Mainfrm->N2->Enabled = false;
pLock->Acquire();
terminate=false;
thread1 = new SendThread(NULL);
pLock->Release();
N2->Enabled = false;
Label_time->Caption = "启动:" + Now().FormatString("MM/DD/HH:NN");
}
void __fastcall TMainfrm::BitBtnStopClick(TObject *Sender)
{
//
if(thread1->Sock->Active)
{
thread1->Sock->Close();
}
thread1->Terminate();
//terminate=true;
Memo_Send->Lines->Add("程序已停止");
if(Form_setup->CSocket_Send->Active == true)
Form_setup->CSocket_Send->Close();
BitBtnStop->Enabled = false;
//延时
int i=0;
for(i=0;i<100000000;i++);
BitBtnStart->Enabled = true;
BitBtnClose->Enabled = true;
N2->Enabled = true;
N3->Enabled = false;
}
当跳出这个函数就出错!!!其中thread1是主线程的成员变量!当我按startbutton 后再
按stopbutton 再按startbutton!就发生当跳出StartButton clik事件函数报错
{
//
BitBtnStart->Enabled = false;
Mainfrm->BitBtnClose->Enabled = false;
Mainfrm->N2->Enabled = false;
pLock->Acquire();
terminate=false;
thread1 = new SendThread(NULL);
pLock->Release();
N2->Enabled = false;
Label_time->Caption = "启动:" + Now().FormatString("MM/DD/HH:NN");
}
void __fastcall TMainfrm::BitBtnStopClick(TObject *Sender)
{
//
if(thread1->Sock->Active)
{
thread1->Sock->Close();
}
thread1->Terminate();
//terminate=true;
Memo_Send->Lines->Add("程序已停止");
if(Form_setup->CSocket_Send->Active == true)
Form_setup->CSocket_Send->Close();
BitBtnStop->Enabled = false;
//延时
int i=0;
for(i=0;i<100000000;i++);
BitBtnStart->Enabled = true;
BitBtnClose->Enabled = true;
N2->Enabled = true;
N3->Enabled = false;
}
当跳出这个函数就出错!!!其中thread1是主线程的成员变量!当我按startbutton 后再
按stopbutton 再按startbutton!就发生当跳出StartButton clik事件函数报错