Xceed Zip Compression Library Documentation
Convert method example for Delphi
Example topics > Convert method example for Delphi

This example allows you to convert an already existing zip file (c:\Temp\TEST.zip) into a Self-Extracting zip file (c:\Temp\zip.exe). The example requires that you place a button and an Xceed Zip control on a form. Assign the following code to the button's click event. A Message box will display the result code.

Delphi Copy Code

procedure TForm1.Button1Click(Sender: TObject);

var

  ResultCode : XcdError; 
begin
  XceedZip1.License( 'your license key' );

  {Specify the full path and name of the zip file which we wish to convert.} 
  XceedZip1.ZipFilename := 'c:\temp\test.zip';  

  {Specify the path to the Self-Extractor Module binary that you want to use.}
  { For this example we use the 32-bit binary }  
  Xceedzip1.SfxBinaryModule := 'c:\temp\xcdsfx32.bin';  

  {Convert the zip file, while specifying the new filename} 
  ResultCode := Xceedzip1.Convert ('c:\temp\test.exe');  

  {Check if it worked successfully} 
  If ResultCode <> xerSuccess Then 
   ShowMessage ('Unsuccessful. Error # ' + inttostr(ResultCode)) 
  Else 
   ShowMessage ('Operation successful!') 
  end;
end.