"String" in Listbox

Plan B: Denken....

Code:
procedure TClient.ClSockRead(Sender: TObject; Socket: TCustomWinSocket);
var
s: String;
sl: TStringList; 
sBuf      : string;
sBuf2     : string;
pData     : pointer;
size : integer;
i, len, anz: Integer;
txt1: String;
txt2 : array[0..255] of String;

begin
  SockRead( Socket, pData, Size );
  if Size > 0 then
  begin
   SetLength( sBuf, Size );
   Move( pData^, sBuf[1], Size);

   sbuf2 := sbuf;
   delete(sbuf2,9,length(sbuf2));
   delete(sbuf,1,9);
   if sbuf2 = 'filelist' then
    begin
     len := Length(sbuf)-1;
     anz := 0;
     for i := 0 to len do begin
       if sbuf[i] <> ',' then begin
        txt2[anz] := txt2[anz]+sbuf[i];
       end
       else begin
        inc(anz);
       end;

     end;
     for i := 0 to anz do
      begin
       listbox1.items.add(txt2[i]);
      end;
      end


   else
   memo1.lines.add(sBuf);
   FreeMem(pData);
  end;
end;
 
Zurück