線上訂房服務-台灣趴趴狗聯合訂房中心
發文 回覆 瀏覽次數:1491
推到 Plurk!
推到 Facebook!

AThread.Data := Client; 如何轉BCB?

 
suntea
一般會員


發表:18
回覆:16
積分:6
註冊:2006-12-12

發送簡訊給我
#1 引用回覆 回覆 發表時間:2006-12-12 13:53:42 IP:59.105.xxx.xxx 未訂閱
嘗試自己翻的,但是新手,觀念似乎就差一步....請教前輩更正
----------------------------------------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);
}


系統時間:2024-05-17 3:06:13
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!