AThread.Data := Client; 如何轉BCB? |
|
suntea
一般會員 發表:18 回覆:16 積分:6 註冊:2006-12-12 發送簡訊給我 |
嘗試自己翻的,但是新手,觀念似乎就差一步....請教前輩更正
----------------------------------------Delphi---------------------------------------------------------------------- TSimpleClient = class(TObject) DNS, Name : String; ListLink : Integer; Thread : Pointer; end; procedure TfrmMain.tcpServerConnect(AThread: TIdPeerThread); var Client : TSimpleClient; begin AThread.Connection.WriteLn('ISD Connection Established...'); AThread.Connection.WriteLn('Please send valid login sequence...'); AThread.Connection.WriteLn('Your Name:'); Client := TSimpleClient.Create; Client.DNS := AThread.Connection.LocalName; Client.Name := 'Logging In'; Client.ListLink := lbClients.Items.Count; Client.Thread := AThread; lbClients.Items.Add(Client.Name); { Assign it to the thread so we can identify it later } AThread.Data := Client; Clients.Add(Client); end; ----------------------------------------BCB---------------------------------------------------------------------- class TSimpleClient { public: String DNS; String Name; int ListLink; void *Thread; }; void __fastcall TForm1::tcpServerConnect(TIdPeerThread *AThread) { TSimpleClient *Client ; AThread->Connection->WriteLn("ISD Connection Established..."); AThread->Connection->WriteLn("Please send valid login sequence..."); AThread->Connection->WriteLn("Your Name:"); Client= new TSimpleClient; Client->DNS = AThread->Connection->LocalName; Client->Name = "Logging In"; Client->ListLink = lbClients->Items->Count; Client->Thread = AThread; lbClients->Items->Add(Client->Name); //{ Assign it to the thread so we can identify it later } AThread->Data = Client; // 出錯 Clients->Add(Client); } |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |