1,594
社区成员




procedure TfrmMain.BroadcastMessage( WhoFrom, TheMessage : String );
var
Count: Integer;
List : TList;
EMote,
Msg : String;
begin
Msg := Trim(TheMessage);
EMote := Trim(memEMotes.Lines.Values[Msg]);
if WhoFrom <> 'System' then
Msg := WhoFrom + ': ' + Msg;
if EMote <> '' then
Msg := Format(Trim(EMote), [WhoFrom]);
List := tcpServer.Threads.LockList;
try
for Count := 0 to List.Count -1 do
try
TIdPeerThread(List.Items[Count]).Connection.WriteLn(Msg);
except
TIdPeerThread(List.Items[Count]).Stop;
end;
finally
tcpServer.Threads.UnlockList;
end;
end;
Client := Clients.Items[Index];
TIdPeerThread(Client.Thread).Connection.WriteLn(Msg);
不知道行不行?