S
softgold
Unregistered / Unconfirmed
GUEST, unregistred user!
从TMemoryStream保存到文件中没问题,但是保存到别的流中就会出现错误。
流的原始数据是由WebBrowser1(TEmbeddedWB)保存的网页源代码。
procedure form1.FormShow;
var
aStream: TMemoryStream;
aStrStream: TStringStream;
begin
WebBrowser1.Navigate('about:blank');
while (WebBrowser1.ReadyState <> ReadyState_Complete) do
Application.ProcessMessages;
aStream:= TMemoryStream.Create;
WebBrowser1.SaveToStream(aStream);
aStream.Position:=0;
aStream.SaveToFile('c:/a.txt');
{把流保存到文件没问题, 就是网页的源代码}
aStream.Position:=0;
aStrStream:= TStringStream.Create('');
aStream.SaveToStream(aStrStream);
ShowMessage(aStrStream.DataString);
aStrStream.Free;
{但是如果要保存到其他的流中,就失败,只得到几个乱码}
end;
流的原始数据是由WebBrowser1(TEmbeddedWB)保存的网页源代码。
procedure form1.FormShow;
var
aStream: TMemoryStream;
aStrStream: TStringStream;
begin
WebBrowser1.Navigate('about:blank');
while (WebBrowser1.ReadyState <> ReadyState_Complete) do
Application.ProcessMessages;
aStream:= TMemoryStream.Create;
WebBrowser1.SaveToStream(aStream);
aStream.Position:=0;
aStream.SaveToFile('c:/a.txt');
{把流保存到文件没问题, 就是网页的源代码}
aStream.Position:=0;
aStrStream:= TStringStream.Create('');
aStream.SaveToStream(aStrStream);
ShowMessage(aStrStream.DataString);
aStrStream.Free;
{但是如果要保存到其他的流中,就失败,只得到几个乱码}
end;