stStream.Position := length(VER_INFO);
//从 DestStream流中载入图像流
UnCompressedStream.LoadFromStream(DestStream);
finally
FreeMem(Buffer);
DestStream.Free;
end;
end;
使用的例子如下:
procedure TForm1.Button5Click(Sender: TObject);
//把指定文件压缩然后保存为另外一个压缩包,
//呵呵,我使用的时候是把后缀改成cab,可以唬一些人吧?
var
SM: TMemoryStream;
begin
if OpenDialog1.Execute then
begin
if SaveDialog1.Execute then
begin
SM := TMemoryStream.Create;
try
Sm.LoadFromFile(OpenDialog1.FileName);
SM.Position := 0;
Compressit(sm, clDefault);
sm.SaveToFile(SaveDialog1.FileName);
finally
SM.Free;
end;
end;
end;
end;
procedure TForm1.BitBtn2Click(Sender: TObject);
//把指定的压缩包解成原来的文件。
var
SM, DM: TMemoryStream;
begin
if OpenDialog1.Execute then
begin
if SaveDialog1.Execute then
begin
SM := TMemoryStream.Create;
DM := TMemoryStream.Create;
try
Sm.LoadFromFile(OpenDialog1.FileName);
SM.Position := 0;
&nb