Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- uses
- System.Zip;
- function ListZipFiles(const AFilename: String; AFiles: TStrings): Boolean;
- var
- Z: TZipFile;
- I: Integer;
- begin
- Result := False;
- Z := TZipFile.Create();
- try
- if Z.IsValid(AFilename) then begin
- try
- Z.Open(AFilename, zmRead)
- except
- Exit
- end;
- Result := True;
- if AFiles <> nil then begin
- AFiles.BeginUpdate();
- try
- AFiles.Clear();
- for I := 0 to Z.FileCount - 1 do
- AFiles.Add(Z.FileName[I])
- finally
- AFiles.EndUpdate()
- end
- end
- end
- finally
- Z.Free()
- end
- end;
- procedure TForm1.FormCreate(Sender: TObject);
- var
- SL: TStringList;
- begin
- SL := TStringList.Create();
- if ListZipFiles('e:\test\file.zip', SL) then
- ShowMessage(SL.Text);
- SL.Free()
- end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement