Xceed Zip for COM/ActiveX on x86/x64 Documentation
Example topics
/ ListZipContents method and ListingFile event example for Delphi
In This Topic
ListZipContents method and ListingFile event example for Delphi
In This Topic
The first function of the following code lists all the files in the zip file "c:\test\my test.zip" that finish with ".txt". For each file listed, the ListingFile event will be triggered. The second function below is a handler written for the ListingFile event that displays each file listed, along with some other of the file's information, in a listbox. The code assumes you have placed a button, a listbox and an Xceed Zip control on a form, and named them Command1, ListBox1 and XceedZip1 respectively.
We start with the handler for the button's click event. The code will start the listing.
Delphi
Copy Code
procedure TForm1.Button1Click(Sender: TObject);
var
ResultCode: xcdError;
begin
XceedZip1.License( 'your license key' );
{ All properties keep their default values except the two below } XceedZip1.FilesToProcess := '*.txt'; XceedZip1.ZipFilename := 'c:\test\my test.zip';
{ Check the result code to make sure it worked properly } if (ResultCode <> xerSuccess) then Listbox1.Items.Add('An error or warning occured, or files were skipped.'); end;
And here's the handler for the ListingFile event. It will add each file's name and info to the listbox.