新
新小丸子
Unregistered / Unconfirmed
GUEST, unregistred user!
写入流数据如下:
var
s:string;
m:tmemorystream;
thepos:integer;
.....
m:=TMemorystream.create;
m.position:=0;
while not query1.eof do
begin
thepos:=m.size;
s:=Format('%8d%10s',[query1.Fields[0].Value.AsInteger,
query1.Fields[1].Value.AsString]);
s.savetostream(m);[red]//这行报错是:record,object or class type required[/red]
s.savetostream('#13#10');[red]//报错同上[/red]
m.position:=thepos+length(s)+1;
query1.next;
end;
socket.sendtext(inttostr(m.size));
接收流如下:
var
buffer:array [0..10000] of byte;
len:integer;
scontent,stitle:string;
N37: TMenuItem;
m:tmemorystream;
..................
len:=socket.ReceiveLength;
socket.ReceiveBuf(buffer,len);
m.Write(buffer,len);
m.Position:=0;
try
scontent.LoadFromStream(m);[red]//这行报错是:record,object or class type required
//此处分解出id和title来赋给sid,stitle[/red]
N37:= TMenuItem.Create(MainMenu1);
N37.Caption := stitle;
N37.OnClick := myClick(N23);
MainMenu1.Items.Add(N37);
finally
clientsocket1.Active:=false;
clientsocket1.Active:=true;
m.Clear;
c:=0;
end;
end;
红色的地方,请各位高手能帮帮我么?[]
var
s:string;
m:tmemorystream;
thepos:integer;
.....
m:=TMemorystream.create;
m.position:=0;
while not query1.eof do
begin
thepos:=m.size;
s:=Format('%8d%10s',[query1.Fields[0].Value.AsInteger,
query1.Fields[1].Value.AsString]);
s.savetostream(m);[red]//这行报错是:record,object or class type required[/red]
s.savetostream('#13#10');[red]//报错同上[/red]
m.position:=thepos+length(s)+1;
query1.next;
end;
socket.sendtext(inttostr(m.size));
接收流如下:
var
buffer:array [0..10000] of byte;
len:integer;
scontent,stitle:string;
N37: TMenuItem;
m:tmemorystream;
..................
len:=socket.ReceiveLength;
socket.ReceiveBuf(buffer,len);
m.Write(buffer,len);
m.Position:=0;
try
scontent.LoadFromStream(m);[red]//这行报错是:record,object or class type required
//此处分解出id和title来赋给sid,stitle[/red]
N37:= TMenuItem.Create(MainMenu1);
N37.Caption := stitle;
N37.OnClick := myClick(N23);
MainMenu1.Items.Add(N37);
finally
clientsocket1.Active:=false;
clientsocket1.Active:=true;
m.Clear;
c:=0;
end;
end;
红色的地方,请各位高手能帮帮我么?[]