Sample code for 30+ languages & platforms
Delphi ActiveX

Transition from ZipEntry.NextEntry to ZipEntry.GetNext

Provides instructions for replacing deprecated NextEntry method calls with GetNext.

Chilkat Delphi ActiveX Downloads

Delphi ActiveX
uses
    Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
    Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Chilkat_TLB;

...

procedure TForm1.Button1Click(Sender: TObject);
var
success: Integer;
zip: TChilkatZip;
entry: IChilkatZipEntry;
finished: Integer;
next: IChilkatZipEntry;
ze: TChilkatZipEntry;
entryValid: Integer;

begin
success := 0;

// ------------------------------------------------------------------------
// The NextEntry method is deprecated.
// See below or code showing how to rewrite using EntryAt/GetNext

zip := TChilkatZip.Create(Self);

success := zip.OpenZip('qa_data/zips/xml_files.zip');
if (success <> 1) then
  begin
    Memo1.Lines.Add(zip.LastErrorText);
    Exit;
  end;

entry := zip.FirstEntry();
if (zip.LastMethodSuccess = 0) then
  begin
    Memo1.Lines.Add('This zip archive is empty.');
    Exit;
  end;

finished := 0;
while finished = 0 do
  begin

    if (entry.IsDirectory = 0) then
      begin
        Memo1.Lines.Add(entry.FileName);
      end
    else
      begin
        Memo1.Lines.Add('(directory) ' + entry.FileName);
      end;
    next := entry.NextEntry();
    if (entry.LastMethodSuccess = 0) then
      begin
        finished := 1;
      end;

    entry := next;
  end;

zip.CloseZip();

Memo1.Lines.Add('----');

// ------------------------------------------------------------------------
// Do the equivalent using EntryAt/GetNext.

success := zip.OpenZip('qa_data/zips/xml_files.zip');

ze := TChilkatZipEntry.Create(Self);
zip.EntryAt(0,ze.ControlInterface);

entryValid := 1;
while entryValid = 1 do
  begin

    if (ze.IsDirectory = 0) then
      begin
        Memo1.Lines.Add(ze.FileName);
      end
    else
      begin
        Memo1.Lines.Add('(directory) ' + ze.FileName);
      end;

    entryValid := ze.GetNext();
  end;

zip.CloseZip();
end;