Xceed Zip Compression Library Documentation
ZipPreprocessingFile event
Xceed Zip control reference > Xceed Zip control events > ZipPreprocessingFile event

Description

The ZipPreprocessingFile event provides the opportunity to view and change a file's information as well as exclude files from being added to the zip file. This event is triggered for each file before any of the files are opened for reading.

Not all file information provided by the ZipPreprocessingFile event's parameters is modifiable. The table below provides a list of parameters provided by ZipPreprocessingFile and shows you which ones can be modified.

When creating self-extracting zip files, you can use macros in the sFilename parameter, and so you can therefore control where each file will be unzipped to by the self-extracting zip file. Also when creating self-extracting zip files, the sFilename parameter can contain an absolute path starting with a drive letter and colon, which will cause the self-extracting zip file to extract the file into an absolute path.

Declaration (event)  
Event ZipPreprocessingFile(sFilename As String, sComment As String, sSourceFilename As String, lSize As Long,
Attributes As xcdFileAttributes, dtLastModified As Date, dtLastAccessed As Date, dtCreated As Date,
xMethod As xcdCompressionMethod, bEncrypted As Boolean, sPassword As String, bExcluded As Boolean,
xReason As xcdSkippingReason, bExisting As Boolean)

Event ZipPreprocessingFile64(sFilename As String, sComment As String, sSourceFilename As String, lSizeLow As Long,
lSizeHigh As Long, xAttributes As xcdFileAttributes, dtLastModified As Date, dtLastAccessed As Date,
dtCreated As Date, xMethod As xcdCompressionMethod, bEncrypted As Boolean, sPassword As String,
bExcluded As Boolean, xReason As xcdSkippingReason, bExisting As Boolean)
Declaration (DLL API)  
xcdZipPreprocessingFileParams * pParams = ( xcdZipPreprocessingFileParams * ) lParam;
                    

Parameters

Parameter Modifiable Description
sFilename YES The file's path and filename, exactly as it will be stored in the zip file.
sComment YES The file's comment.
sSourceFilename  NO The real path and filename of the file about to be zipped.
lSize  NO The file's size, in bytes.
lSizeLow
lSizeHigh (64)
NO The 32 low-order and high-order bits representing the file's size, in bytes.
xAttributes YES The file's attributes.
dtLastModified YES The last modification date and time stamp.
dtLastAccessed YES The last accessed date and time stamp.
dtCreated YES The creation date and time stamp.
xMethod YES The compression method.
bEncrypted YES Is this file going to be encrypted?
sPassword YES If so, it will be encrypted with this password.
bExcluded YES Will this file be zipped or excluded?
xReason  NO If it will be excluded, why?
bExisting  NO When zipping to an existing zip file, this parameter indicates if the file about to be zipped already exists in the destination zip file.

Remarks

If you need an event that occurs right before each file is actually opened to be zipped, then you can use FileStatus event.

Version 6.0 of Xceed Zip Compression Library introduces AES encryption support. Because of export restrictions in some countries, a new license validation had to be implemented. License keys that begin with "ZIP" enable AES encryption support while "ZIL" license keys, either trial or registered, do not activate AES encryption support.

When zipping in trial mode with a "ZIP" (ZIP60 or more recent) license key, if the EncryptionMethod property is set to xemWinZipAES, the EncryptionPassword property will be changed to "This is a trial password" only if it had been modified prior to setting the EncryptionMethod property. If a password other than "This is a trial password" is specified in the EncryptionPassword property after the EncryptionMethod property has been set, a "Set not permitted" error will be thrown. The password can also be specified via the ZipPreprocessingFile event however if a password other than "This is a trial password" is specified, the SkippingFile event will be raised with a xsrNotLicenced skipping reason.

When unzipping an AES-encrypted zip file in trial mode with a "ZIP" license key, the only password that can be used is "This is a trial password" and it must be specified via the EncryptionPassword property, InvalidPassword event, or UnzipPreprocessingFile event. If a password other than "This is a trial password" is specified, the SkippingFile event will be raised with a xsrNotLicenced skipping reason. When unzipping, the EncryptionMethod property does not need to be set.

For both registered and trial "ZIP" and "ZIL" license keys, if the EncryptionPassword property is an empty string, the files will not be encrypted regardless of the value of the EncryptionMethod.

Applicable methods

Zip