The ZipSFX component implements a PKZip-compatible Zip compressor to create a self-extracting archive which will run natively on Windows platforms.
The component uses the Deflate algorithm specified in RFC 1951 for compression, and then creates a self-extracting executable archive. This exe will bring up a dialog that will allow the user to select the target directory in which to decompress the files. There is also an optional splash screen that may be displayed before decompression. The text for this splash screen may be set with the BannerText property. You can also set the text that appears on the title bar of each dialog box using the CaptionText property.
Example (Creating a Self-Extracting Archive)
component.ArchiveFile = "c:\test.exe" component.RecurseSubdirectories = true component.SourceDirectory = "c:\foo\" component.CaptionText = "Testing ZipSFX" component.BannerText = "Press continue to decompress the archive." component.CreateSFX()
Note: When creating a self-extracting archive which exceeds 4 GB or more of uncompressed data or which contains more than 64K files, the component will create a 64-bit Zip archive.
The self-extracting archive that is created by the ZipSFX component is a Windows application. However, there are command line options available if you wish to batch multiple files. The options are:
|targetpath||Path to decompress the archive to. This overrides the ExtractToPath. "." indicates the current directory (if no ExtractToPath was specified and no targetpath is given, the archive is decompressed to the current directory).|
|overwrite||If set to true, the archive will automatically overwrite existing files (thus suppressing the message box asking you to overwrite or not)|
|displaymessage||If set to false, it will suppress the display of the "Extraction Complete" message after the archive has finished (this may also be accomplished by setting the CompleteMessage config setting to "").|
|openfile||If set to false, this option will override opening the file indicated by FileToExecute. (Alternatively, set FileToExecute to "").|
|password||The password used to decrypt the archive. If the archive is not encrypted this option is ignored. However if the archive is encrypted and no password is supplied, decompression will fail.|
For example, the following suppresses all questions and message boxes, and decompress to the current
directory, use the following options:
ZipExtractor /targetpath="." /overwrite=1 /displaymessage=0 /openfile=0 /password=pass
Note that if you run the self-extracting archive with any command line options, the pop up message box containing the BannerText will be suppressed.
The following is the full list of the properties of the component with short descriptions. Click on the links for further details.
|ArchiveFile||The name of the self-extracting zip archive to create.|
|BannerText||Optional banner text to show before the self-extraction starts.|
|CaptionText||Optional caption (title) text for the self-extractor dialogs.|
|CompressionLevel||The compression level to use.|
|ExtractToPath||Optional target directory for the self-extractor.|
|FileToExecute||Optional file to execute (open) after the archive is extracted.|
|Password||An optional password for the self-extracting archive.|
|RecurseSubdirectories||Whether or not to recurse into subdirectories during archive creation.|
|SourceDirectory||Directory to be compressed into a self-extracting archive.|
The following is the full list of the methods of the component with short descriptions. Click on the links for further details.
|Config||Sets or retrieves a configuration setting.|
|CreateSFX||Compresses the files and creates a self-extracting archive.|
|Reset||Resets the component.|
The following is the full list of the events fired by the component with short descriptions. Click on the links for further details.
|Error||Information about non-fatal errors.|
|Progress||Fired as progress is made.|
The following is a list of configuration settings for the component with short descriptions. Click on the links for further details.
|CompleteMessage||Message to notify user that extraction has finished normally.|
|ExtractorStub||Path to optional self-extractor executable stub.|
|FileToExecuteParams||List of parameters to pass to FileToExecute.|
|InstallationMode||This setting will install to ExtractToPath, run FileToExecute, and then remove the extracted files.|
|RequireAdminPrivs||Specifies whether the created executable requires Administrator privileges.|
|SilentExtraction||Specifies whether the archive should hide all UI interaction while extracting.|
|BuildInfo||Information about the product's build.|
|CodePage||The system code page used for Unicode to Multibyte translations.|
|LicenseInfo||Information about the current license.|
|UseInternalSecurityAPI||Tells the component whether or not to use the system security libraries or an internal implementation.|