自己按F1按了好几天,终于找到了一个“愚蠢”的解决方法了
方法如下:
var
//加入以上两个变量
buf
Char;
bufSize:Integer;
........
........
aMemoryStream:TMemoryStream;
ExtractedStream:TMemoryStream;
aTextFile:TStingList;
......
aMemoryStream:=TMemoryStream.Create;
TBlobField(A).SaveToStream(aMemoryStream);
ExtractedStream:=TMemoryStream.Create;
VCLZip1:=TVCLZip.Create(Sender);
VCLZip1.ArchiveStream:=aMemoryStream;
VCLZip1.UnZipToStream(ExtractedStream,'aFile.TXT');//ZIP中只有一个aFile.TXT文件
aTextFile:=TStringList.Create;
ExtractedStream.Position:=0;
bufSize:=ExtractedStream.Size;
INC(ExtractedStream);
buf:=AllocMem(bufSize);
ExtractedStream.Read(buf^,bufSize);//晕啊,为会要这样子,直接LoadFromStream不行啊
//aTextFile.LoadFromStream(Extractedstream);//奇怪的是,这个aTextFile.Count总是0
aTextFile.Text:=String(buf^);//这样子就OK啦^^
FreeMem(buf,bufSize);
...........