线程中idTCPClient连接的问题
void __fastcall MyThreadForTcpClient::Execute(){ //---- Place thread code here ---- Synchronize(GETMSG);}//---------------------------------------void __fastcall MyThreadForTcpClient::GETMSG(){ TIdTCPClient *IdTCPClient; //ShowMessage("Hello"); IdTCPClient->Port = IdTCP->EditServerPort->Text.ToInt(); IdTCPClient->Host = "127.0.0.1"; IdTCPClient->Connect(); if(IdTCPClient->Connected() == true) { //ShowMessage("Hello"); UnicodeString MGS = ""; for(;;) { MGS = IdTCPClient->Socket->ReadLn(enUTF8); if(MGS != "") { IdTCP->EditReceiveMessage->Text = MGS; MGS = ""; } Sleep(1000); } }}