Xceed Zip Compression Library Documentation
Creating a self-extracting zip file
Getting started quickly > Creating a self-extracting zip file

Creating a self-extracting zip file directly from a group of files 

The method for creating a self-extracting zip file is very similar to that of creating a regular zip file, except that you must specify the self-extractor binary to use. You'll also want to (although it is optional) give your zip file a ".exe" extension instead of the usual ".zip".

Here we'll follow the same steps as the zipping files topic, but modified for creating a self-extracting zip file. To create a new self-extracting zip file, perform the following 5 steps. Put the Xceed Zip control on a form, then:

Here is sample VB code for these 5 steps:

Visual Basic Copy Code

' Don't forget to put an Xceed Zip control on a form
Dim ResultCode As xcdError
Call XceedZip1.License( "your license key" ) 

XceedZip1.ZipFilename = "c:\test\A self-extracting zip file.exe"
XceedZip1.FilesToProcess = "c:\documents\word\*.doc"
XceedZip1.SfxBinaryModule = "xcdsfx32.bin" 

ResultCode = XceedZip1.Zip 

If ResultCode = xerSuccess Then 
   MsgBox "Created successfully." 
Else   
   MsgBox XceedZip1.GetErrorDescription(xvtError, ResultCode) 
EndIf

Here is sample Delphi code for these 5 steps:

Delphi Copy Code

{ Don't forget to put an Xceed Zip control on a form }
var xErr : xcdError; 

begin
   XceedZip1.License( 'your license key' ); 

   XceedZip1.ZipFilename := 'c:\test\A self-extracting zip file.exe'; 
   XceedZip1.FilesToProcess := 'c:\documents\word\*.doc'; 
   XceedZip1.SfxBinaryModule := 'c:\Program Files\Xceed Components\Bin\Sfx\xcdsfx32.bin';  

   xErr := XceedZip1.Zip; 

   ShowMessage( XceedZip1.GetErrorDescription( xvtError, xErr ) ); 

end;

 

Things you should consider 

You will probably want to customize the self-extracting zip files you create. For example, you may want to change its title and introduction message, or have it suggest a default unzipping folder. There is a group of properties that start with "Sfx" designed to let you do just that. See the About the Self-Extractor Module properties topic to find out what you can customize. 

Other than customizing the appearance and behavior of the self-extracting zip file, you should also ask yourself the following questions:

Other questions you may want to consider are:

If there's anything else you need to do that's not mentioned here, consult the Properties topic, or search the index – chances are, Xceed Zip does what you need. If not, ask Xceed Software whether it's possible or not.