Zip Delphi DLL Reference Documentation

Zip

Current Version: 10.0.0

Zip compression component.

Create/Dispose

var
myObject: HCkZip;

begin
myObject := CkZip_Create();

// ...

CkZip_Dispose(myObject);
end;
function CkZip_Create: HCkZip; stdcall;

Creates an instance of the HCkZip object and returns a handle (i.e. a Pointer). The handle is passed in the 1st argument for the functions listed on this page.

procedure CkZip_Dispose(handle: HCkZip); stdcall;

Objects created by calling CkZip_Create must be freed by calling this method. A memory leak occurs if a handle is not disposed by calling this function.

Properties

AbortCurrent
function CkZip_getAbortCurrent(objHandle: HCkZip): wordbool; stdcall;
procedure CkZip_putAbortCurrent(objHandle: HCkZip; newPropVal: wordbool); stdcall;
Introduced in version 9.5.0.58

When set to True, causes the currently running method to abort. Methods that always finish quickly (i.e.have no length file operations or network communications) are not affected. If no method is running, then this property is automatically reset to False when the next method is called. When the abort occurs, this property is reset to False. Both synchronous and asynchronous method calls can be aborted. (A synchronous method call could be aborted by setting this property from a separate thread.)

top
AppendFromDir
procedure CkZip_getAppendFromDir(objHandle: HCkZip; outPropVal: HCkString); stdcall;
procedure CkZip_putAppendFromDir(objHandle: HCkZip; newPropVal: PWideChar); stdcall;
function CkZip__appendFromDir(objHandle: HCkZip): PWideChar; stdcall;

When files are added to a Zip archive, they are appended from this directory. For example, to add all the files under c:/abc/123/myAppDir, this property could be set to "c:/abc/123", and "myAppDir/*" would be passed to AppendFiles. The path that is saved in the .zip would be "myAppDir/". (The value of the AppendFromDir property does not become part of the file path saved in the .zip.)

See the notes about PWideChar memory ownership and validity.

More Information and Examples
top
AutoRun
procedure CkZip_getAutoRun(objHandle: HCkZip; outPropVal: HCkString); stdcall;
procedure CkZip_putAutoRun(objHandle: HCkZip; newPropVal: PWideChar); stdcall;
function CkZip__autoRun(objHandle: HCkZip): PWideChar; stdcall;

(Relevant only when running on a Microsoft Windows operating system.) Optional when creating Windows-based self-extracting EXEs. This is the name of an executable contained within the to-be-created EXE that will automatically be run after extraction. (This is typically something like "setup.exe")

See the notes about PWideChar memory ownership and validity.

top
AutoRunParams
procedure CkZip_getAutoRunParams(objHandle: HCkZip; outPropVal: HCkString); stdcall;
procedure CkZip_putAutoRunParams(objHandle: HCkZip; newPropVal: PWideChar); stdcall;
function CkZip__autoRunParams(objHandle: HCkZip): PWideChar; stdcall;

(Relevant only when running on a Microsoft Windows operating system.) Command line parameters that get passed to the AutoRun executable.

See the notes about PWideChar memory ownership and validity.

top
AutoTemp
function CkZip_getAutoTemp(objHandle: HCkZip): wordbool; stdcall;
procedure CkZip_putAutoTemp(objHandle: HCkZip; newPropVal: wordbool); stdcall;

(Relevant only when running on a Microsoft Windows operating system.) This option applies to creating Windows-based self-extracting EXEs. If True, the to-be-created EXE will automatically select and create a temporary directory for unzipping. This property is often used in conjunction with the AutoRun property to create a self-extracting EXE that automatically unzips to a temp directory and runs a setup.exe without interaction with the user.

Note: To create a self-extracting EXE with no user-interaction, set the following properties to these values:

ExeSilentProgress = False
ExeNoInterface = True
ExeFinishNotifier = False

The default AutoTemp value is False.

top
CaseSensitive
function CkZip_getCaseSensitive(objHandle: HCkZip): wordbool; stdcall;
procedure CkZip_putCaseSensitive(objHandle: HCkZip; newPropVal: wordbool); stdcall;

If True then all methods that get or search for zip entries by name will use case-sensitive filename matching. If False then filename matching will be case insensitive. Methods affected by this property include GetEntryByName, UnzipMatching, FirstMatchingEntry, etc.

The default value is False.

top
ClearArchiveAttribute
function CkZip_getClearArchiveAttribute(objHandle: HCkZip): wordbool; stdcall;
procedure CkZip_putClearArchiveAttribute(objHandle: HCkZip; newPropVal: wordbool); stdcall;

Set this to True to clear the FILE_ATTRIBUTE_ARCHIVE file attribute of each file (in the local filesystem) during a zipping operation.

The default value is False.

Note: The archive attribute or bit, is a Windows file attribute that when is set, it indicates that the file has changed since the last backup operation. When this property is True, Chilkat Zip will clear the archive attribute of each local file after it has been successfully added to the zip.

top
ClearReadOnlyAttr
function CkZip_getClearReadOnlyAttr(objHandle: HCkZip): wordbool; stdcall;
procedure CkZip_putClearReadOnlyAttr(objHandle: HCkZip; newPropVal: wordbool); stdcall;

If True, the read-only attribute is automatically cleared when unzipping. The default value of this property is False, which leaves the read-only attribute unchanged when unzipping.

top
Comment
procedure CkZip_getComment(objHandle: HCkZip; outPropVal: HCkString); stdcall;
procedure CkZip_putComment(objHandle: HCkZip; newPropVal: PWideChar); stdcall;
function CkZip__comment(objHandle: HCkZip): PWideChar; stdcall;

The global Zip file comment.

See the notes about PWideChar memory ownership and validity.

top
DebugLogFilePath
procedure CkZip_getDebugLogFilePath(objHandle: HCkZip; outPropVal: HCkString); stdcall;
procedure CkZip_putDebugLogFilePath(objHandle: HCkZip; newPropVal: PWideChar); stdcall;
function CkZip__debugLogFilePath(objHandle: HCkZip): PWideChar; stdcall;

If set to a file path, causes each Chilkat method or property call to automatically append it's LastErrorText to the specified log file. The information is appended such that if a hang or crash occurs, it is possible to see the context in which the problem occurred, as well as a history of all Chilkat calls up to the point of the problem. The VerboseLogging property can be set to provide more detailed information.

This property is typically used for debugging the rare cases where a Chilkat method call hangs or generates an exception that halts program execution (i.e. crashes). A hang or crash should generally never happen. The typical causes of a hang are:

  1. a timeout related property was set to 0 to explicitly indicate that an infinite timeout is desired,
  2. the hang is actually a hang within an event callback (i.e. it is a hang within the application code), or
  3. there is an internal problem (bug) in the Chilkat code that causes the hang.

See the notes about PWideChar memory ownership and validity.

More Information and Examples
top
DecryptPassword
procedure CkZip_getDecryptPassword(objHandle: HCkZip; outPropVal: HCkString); stdcall;
procedure CkZip_putDecryptPassword(objHandle: HCkZip; newPropVal: PWideChar); stdcall;
function CkZip__decryptPassword(objHandle: HCkZip): PWideChar; stdcall;

When opening a password-protected or AES encrypted Zip, this is the password to be used for decryption. Encrypted Zips may be opened without setting a password, but the contents cannot be unzipped without setting this password.

Note:The SetPassword method has the effect of setting both this property as well as the EncryptPassword property. The SetPassword method should no longer be used. It has been replaced by the DecryptPassword and EncryptPassword properties to make it possible to open an encrypted zip and re-write it with a new password.

See the notes about PWideChar memory ownership and validity.

top
DiscardPaths
function CkZip_getDiscardPaths(objHandle: HCkZip): wordbool; stdcall;
procedure CkZip_putDiscardPaths(objHandle: HCkZip; newPropVal: wordbool); stdcall;

If True, discards all file path information when zipping. The default value is False.

top
Encryption
function CkZip_getEncryption(objHandle: HCkZip): Integer; stdcall;
procedure CkZip_putEncryption(objHandle: HCkZip; newPropVal: Integer); stdcall;

Indicate whether the Zip is to be strong encrypted or not. Valid values are 0 (not encrypted) or 4 (AES encrypted). When this property is set to the value 4, WinZip AES compatible encrypted zip archives are produced.

Note: Prior to Chilkat v9.4.1, other possible values for this property were: 1 (blowfish), 2 (twofish), and 3 (rijndael). These settings originally provided a way to produce strong encrypted zips prior to when the AES encrypted Zip standard existed. Using these legacy values (1, 2, or 3) produced encrypted zips that only applications using Chilkat could read. Chilkat no longer supports these custom modes of encryption. If using an older version of Chilkat with one of these deprecated encryption modes, make sure to decrypt using the old Chilkat version and re-encrypt using mode 4 (WinZip compatible AES encryption) prior to updating to the new Chilkat version.

Important:The Encryption and PasswordProtect properties are mutually exclusive. PasswordProtect corresponds to the older Zip 2.0 encryption, commonly referred to as a "password-protected" zip. If the PasswordProtect is set to True, the Encryption property should be set to 0. If the Encryption property is set to a non-zero value, then PasswordProtect should be set to False. A zip cannot be both password-protected and strong-encrypted.

top
EncryptKeyLength
function CkZip_getEncryptKeyLength(objHandle: HCkZip): Integer; stdcall;
procedure CkZip_putEncryptKeyLength(objHandle: HCkZip; newPropVal: Integer); stdcall;

The encryption key length if AES, Blowfish, Twofish, or WinZip-compatible AES encryption is used. This value must be 128, 192, or 256. The default value is 128.

top
EncryptPassword
procedure CkZip_getEncryptPassword(objHandle: HCkZip; outPropVal: HCkString); stdcall;
procedure CkZip_putEncryptPassword(objHandle: HCkZip; newPropVal: PWideChar); stdcall;
function CkZip__encryptPassword(objHandle: HCkZip): PWideChar; stdcall;

The password used when writing a password-protected or strong-encrytped Zip.

Note:The SetPassword method has the effect of setting both this property as well as the DecryptPassword property. The SetPassword method should no longer be used. It has been replaced by the DecryptPassword and EncryptPassword properties to make it possible to open an encrypted zip and re-write it with a new password.

See the notes about PWideChar memory ownership and validity.

top
ExeDefaultDir
procedure CkZip_getExeDefaultDir(objHandle: HCkZip; outPropVal: HCkString); stdcall;
procedure CkZip_putExeDefaultDir(objHandle: HCkZip; newPropVal: PWideChar); stdcall;
function CkZip__exeDefaultDir(objHandle: HCkZip): PWideChar; stdcall;

(Relevant only when running on a Microsoft Windows operating system.) Specifies the default unzip directory path to appear in the user-interface dialog box when the Windows-based self-extracting EXE is run.

See the notes about PWideChar memory ownership and validity.

top
ExeFinishNotifier
function CkZip_getExeFinishNotifier(objHandle: HCkZip): wordbool; stdcall;
procedure CkZip_putExeFinishNotifier(objHandle: HCkZip; newPropVal: wordbool); stdcall;

(Relevant only when running on a Microsoft Windows operating system.) If set to True, a "Finished" dialog box is displayed when the self-extracting EXE is finished extracting. The caption, title, and button text of the finish notifier dialog may be customized by calling SetExeConfigParam. The default value is False.

top
ExeIconFile
procedure CkZip_getExeIconFile(objHandle: HCkZip; outPropVal: HCkString); stdcall;
procedure CkZip_putExeIconFile(objHandle: HCkZip; newPropVal: PWideChar); stdcall;
function CkZip__exeIconFile(objHandle: HCkZip): PWideChar; stdcall;

(Relevant only when running on a Microsoft Windows operating system.) Applies to creating self-extracting EXEs. This property can be set to a pre-existing icon filename (.ico) that will be embedded within the to-be-created EXE and set as its default icon.

Note: This property is only possible for 32-bit applications. (Meaning that the application that is creating the self-extracting EXE must be a 32-bit application if an ExeIconFile is to be used.)

See the notes about PWideChar memory ownership and validity.

top
ExeNoInterface
function CkZip_getExeNoInterface(objHandle: HCkZip): wordbool; stdcall;
procedure CkZip_putExeNoInterface(objHandle: HCkZip; newPropVal: wordbool); stdcall;

(Relevant only when running on a Microsoft Windows operating system.) Applies to creating Windows-based self-extracting EXEs. When set to True, the to-be-created EXE will run without a user-interface. The default value is False.

Note: The ExeSilentProgress property needs to be set to True for the extract to be truly silent.

Important: If the AutoTemp property = True and there is no AutoRun EXE, and there is no ExeUnzipDir set, then the self-extracting EXE will always display a dialog to get the unzip directory. The reason is that it makes no sense to silently unzip to an auto-selected (and unknown) temp directory without anything happening afterwards.

Important: If the self-extracting EXE is encrypted, a password dialog will be displayed. The password dialog may be suppressed if the password is provided on the command line via the -pwd command-line option.

top
ExeSilentProgress
function CkZip_getExeSilentProgress(objHandle: HCkZip): wordbool; stdcall;
procedure CkZip_putExeSilentProgress(objHandle: HCkZip; newPropVal: wordbool); stdcall;

(Relevant only when running on a Microsoft Windows operating system.) Determines whether a progress dialog is displayed when the self-extracting EXE is run. If ExeNoInterface = False (i.e. there is a main dialog with the ability to select the unzip directory), then the progress dialog is (by default) shown as a progress bar within the main dialog -- and this property has no effect. If ExeNoInterface = True, then a progress-only dialog is displayed if ExeSilentProgress = False. The default value of ExeSilentProgress is True.

top
ExeTitle
procedure CkZip_getExeTitle(objHandle: HCkZip; outPropVal: HCkString); stdcall;
procedure CkZip_putExeTitle(objHandle: HCkZip; newPropVal: PWideChar); stdcall;
function CkZip__exeTitle(objHandle: HCkZip): PWideChar; stdcall;

(Relevant only when running on a Microsoft Windows operating system.) Applies to creating Windows-based self-extracting EXEs. Sets the title of the main user-interface dialog that appears when the self-extracting EXE runs.

See the notes about PWideChar memory ownership and validity.

top
ExeUnzipCaption
procedure CkZip_getExeUnzipCaption(objHandle: HCkZip; outPropVal: HCkString); stdcall;
procedure CkZip_putExeUnzipCaption(objHandle: HCkZip; newPropVal: PWideChar); stdcall;
function CkZip__exeUnzipCaption(objHandle: HCkZip): PWideChar; stdcall;

(Relevant only when running on a Microsoft Windows operating system.) Applies to creating MS Windows-based self-extracting EXEs. Sets the unzipping caption of the main user-interface dialog that appears when the self-extracting EXE runs.

See the notes about PWideChar memory ownership and validity.

top
ExeUnzipDir
procedure CkZip_getExeUnzipDir(objHandle: HCkZip; outPropVal: HCkString); stdcall;
procedure CkZip_putExeUnzipDir(objHandle: HCkZip; newPropVal: PWideChar); stdcall;
function CkZip__exeUnzipDir(objHandle: HCkZip): PWideChar; stdcall;

(Relevant only when running on a Microsoft Windows operating system.) Applies to creating MS Windows self-extracting EXEs. Stores a pre-defined unzip directory within the self-extracting EXE so that it automatically unzips to this directory without user-intervention.

Environment variables may be included if surrounded by percent characters. For example: %TEMP%. Environment variables are expanded (i.e. resolved) when the self-extracting EXE runs.

Note: UNC paths, such as \\servername\path, are not supported.

Note: To create a self-extracting EXE with no user-interaction, set the following properties to these values:

ExeSilentProgress  = False<br>
ExeNoInterface = True<br>
ExeFinishNotifier = False

See the notes about PWideChar memory ownership and validity.

top
ExeWaitForSetup
function CkZip_getExeWaitForSetup(objHandle: HCkZip): wordbool; stdcall;
procedure CkZip_putExeWaitForSetup(objHandle: HCkZip; newPropVal: wordbool); stdcall;

(Relevant only when running on a Microsoft Windows operating system.) If True, the self-extracting EXE will wait for the AutoRun EXE to complete before it exits. If False, the self-extracting EXE dialog (or process if running silently with no user-interface), is allowed to exit prior to the completion of the AutoRun EXE. The default value is True.

top
ExeXmlConfig
procedure CkZip_getExeXmlConfig(objHandle: HCkZip; outPropVal: HCkString); stdcall;
procedure CkZip_putExeXmlConfig(objHandle: HCkZip; newPropVal: PWideChar); stdcall;
function CkZip__exeXmlConfig(objHandle: HCkZip): PWideChar; stdcall;

(Relevant only when running on a Microsoft Windows operating system.) Allows for an XML config document to be used to specify all possible options for self-extracting EXEs. This property is a string containing the XML config document.

The XML should have this format:

<SfxConfig>
	<ErrPwdTitle>Title for incorrect password dialog</ErrPwdTitle>
	<ErrPwdCaption>Caption for incorrect password dialog</ErrPwdCaption>
	<FinOkBtn>Text on finish notifier button</FinOkBtn>
	<PwdOkBtn>Text on password challenge dialog's "OK" button.</PwdOkBtn>
	<PwdCancelBtn>Text on password challenge dialog's Cancel button.</PwdCancelBtn>
	<ErrInvalidPassword>Incorrect password error message.</ErrInvalidPassword>
	<MainUnzipBtn>Text on main dialog's unzip button</MainUnzipBtn>
	<MainCloseBtn>Text on main dialog's quit/exit button</MainCloseBtn>
	<MainBrowseBtn>Text on main dialog's browse-for-directory button.</MainBrowseBtn>
	<MainUnzipLabel>Caption displayed in main dialog.</MainUnzipLabel>
	<AutoTemp>"1|0 (Maps to the AutoTemp property)"</AutoTemp>
	<Cleanup>"1|0 (Deletes extracted files after the SetupExe is run.)"</Cleanup>
	<Debug>"1|0  (If 1, the EXE will not extract any files.)"</Debug>
	<Verbose>"1|0 (If 1, then verbose information is sent to the log.)"</Verbose>
	<ShowFin>"1|0" Maps to ExeFinishNotifier property.</ShowFin>
	<ShowMain>"1|0" Maps to ExeNoInterface property.</ShowMain>
	<ShowProgress>"1|0" Maps to ExeSilentProgress property.</ShowProgress>
	<WaitForSetup>"1|0" Maps to ExeWaitForSetup property.</WaitForSetup>
	<Encryption>"1|0"  1=Yes, 0=No</Encryption>
	<KeyLength>128|192|256</KeyLength>
	<SetupExe>EXE to run after extracting. (Maps to AutoRun property)</SetupExe>
	<UnzipDir>Pre-defined unzip directory. (Maps to ExeUnzipDir property, 
                                                UNC paths, such as \\servername\path, are not supported.)>
	<DefaultDir>Default unzip directory to appear in the main dialog. 
                                                (Maps to ExeDefaultDir property)</DefaultDir>
	<IconFile>Icon file to be used (Maps to ExeIconFile property)</IconFile>
	<Url>Maps to ExeSourceUrl property.</Url>
	<MainTitle>Maps to ExeTitle property.</MainTitle>
	<MainCaption>Maps to ExeUnzipCaption property.</MainCaption>
	<FinTitle>Title for the finish notifier dialog.</FinTitle>
	<FinCaption>Caption for the finish notifier dialog.</FinTitle>
	<ProgressTitle>Title for the progress dialog.</ProgressTitle>
	<ProgressCaption>Caption for the progress dialog.</ProgressCaption>
	<PwTitle>Title for the password challenge dialog.</PwTitle>
	<PwCaption>Caption for the password challenge dialog.</PwCaption>
</SfxConfig>

A self-extracting EXE can be run from the command line with the "-log {logFilePath}" option to create a log with information for debugging.

See the notes about PWideChar memory ownership and validity.

top
FileCount
function CkZip_getFileCount(objHandle: HCkZip): Integer; stdcall;

The number of files (excluding directories) contained within the Zip.

top
FileName
procedure CkZip_getFileName(objHandle: HCkZip; outPropVal: HCkString); stdcall;
procedure CkZip_putFileName(objHandle: HCkZip; newPropVal: PWideChar); stdcall;
function CkZip__fileName(objHandle: HCkZip): PWideChar; stdcall;

The path (absolute or relative) of the Zip archive. This is the path of the file that is created or overwritten when the zip is saved.

See the notes about PWideChar memory ownership and validity.

top
HasZipFormatErrors
function CkZip_getHasZipFormatErrors(objHandle: HCkZip): wordbool; stdcall;

True if the opened zip contained file format errors (that were not severe enough to prevent the zip from being opened and parsed).

top
HeartbeatMs
function CkZip_getHeartbeatMs(objHandle: HCkZip): Integer; stdcall;
procedure CkZip_putHeartbeatMs(objHandle: HCkZip; newPropVal: Integer); stdcall;

The number of milliseconds between each AbortCheck event callback. The AbortCheck callback allows an application to abort any method call prior to completion. If HeartbeatMs is 0 (the default), no AbortCheck event callbacks will fire.

top
IgnoreAccessDenied
function CkZip_getIgnoreAccessDenied(objHandle: HCkZip): wordbool; stdcall;
procedure CkZip_putIgnoreAccessDenied(objHandle: HCkZip; newPropVal: wordbool); stdcall;

If True, then files that cannot be read due to "access denied" (i.e. a file permission error) will be ignored and the call to WriteZip, WriteZipAndClose, WriteExe, etc. will return a success status. If False, then the "access denied" filesystem errors are not ignored and any occurrence will cause the zip writing to fail. The default value is True.

top
LastErrorHtml
procedure CkZip_getLastErrorHtml(objHandle: HCkZip; outPropVal: HCkString); stdcall;
function CkZip__lastErrorHtml(objHandle: HCkZip): PWideChar; stdcall;

Provides information in HTML format about the last method/property called. If a method call returns a value indicating failure, or behaves unexpectedly, examine this property to get more information.

See the notes about PWideChar memory ownership and validity.

top
LastErrorText
procedure CkZip_getLastErrorText(objHandle: HCkZip; outPropVal: HCkString); stdcall;
function CkZip__lastErrorText(objHandle: HCkZip): PWideChar; stdcall;

Provides information in plain-text format about the last method/property called. If a method call returns a value indicating failure, or behaves unexpectedly, examine this property to get more information.

See the notes about PWideChar memory ownership and validity.

top
LastErrorXml
procedure CkZip_getLastErrorXml(objHandle: HCkZip; outPropVal: HCkString); stdcall;
function CkZip__lastErrorXml(objHandle: HCkZip): PWideChar; stdcall;

Provides information in XML format about the last method/property called. If a method call returns a value indicating failure, or behaves unexpectedly, examine this property to get more information.

See the notes about PWideChar memory ownership and validity.

top
LastMethodSuccess
function CkZip_getLastMethodSuccess(objHandle: HCkZip): wordbool; stdcall;
procedure CkZip_putLastMethodSuccess(objHandle: HCkZip; newPropVal: wordbool); stdcall;

Indicate whether the last method call succeeded or failed. A value of True indicates success, a value of False indicates failure. This property is automatically set for method calls. It is not modified by property accesses. The property is automatically set to indicate success for the following types of method calls:

  • Any method that returns a string.
  • Any method returning a Chilkat object, binary bytes, or a date/time.
  • Any method returning a standard boolean status value where success = True and failure = False.
  • Any method returning an integer where failure is defined by a return value less than zero.

Note: Methods that do not fit the above requirements will always set this property equal to True. For example, a method that returns no value (such as a "void" in C++) will technically always succeed.

top
MaxDate
procedure CkZip_getMaxDate(objHandle: HCkZip; outPropVal: HCkString); stdcall;
procedure CkZip_putMaxDate(objHandle: HCkZip; newPropVal: PWideChar); stdcall;
function CkZip__maxDate(objHandle: HCkZip): PWideChar; stdcall;
Introduced in version 10.0.0

The maximum last-modified date/time of a file to process for either adding to a .zip, or unzipping. This property uses the timestamp date/time string format. Here are some examples:

  • YYYY-MM-DD (e.g., 2024-07-31)
  • YYYY-MM-DDTHH:MM:SS±HH:MM (e.g., 2024-07-31T12:34:56+02:00)
  • 2024-07-31T12:34:56Z (the "Z" denotes Zulu time, or UTC)

This property defaults to the empty string, which means there is no maximum.

See the notes about PWideChar memory ownership and validity.

top
MaxUncompressSize
function CkZip_getMaxUncompressSize(objHandle: HCkZip): LongWord; stdcall;
procedure CkZip_putMaxUncompressSize(objHandle: HCkZip; newPropVal: LongWord); stdcall;
Introduced in version 9.5.0.96

An application can set this property to prevent unzipping any files larger than a max size uncompressed. The default value of this property is 0, which means any size file can be unzipped.

top
MinDate
procedure CkZip_getMinDate(objHandle: HCkZip; outPropVal: HCkString); stdcall;
procedure CkZip_putMinDate(objHandle: HCkZip; newPropVal: PWideChar); stdcall;
function CkZip__minDate(objHandle: HCkZip): PWideChar; stdcall;
Introduced in version 10.0.0

The minimum last-modified date/time of a file to process for either adding to a .zip, or unzipping. This property uses the timestamp date/time string format. Here are some examples:

  • YYYY-MM-DD (e.g., 2024-07-31)
  • YYYY-MM-DDTHH:MM:SS±HH:MM (e.g., 2024-07-31T12:34:56+02:00)
  • 2024-07-31T12:34:56Z (the "Z" denotes Zulu time, or UTC)

This property defaults to the empty string, which means there is no minimum.

See the notes about PWideChar memory ownership and validity.

top
NumEntries
function CkZip_getNumEntries(objHandle: HCkZip): Integer; stdcall;

The number of entries in the Zip, including both files and directories.

More Information and Examples
top
OemCodePage
function CkZip_getOemCodePage(objHandle: HCkZip): Integer; stdcall;
procedure CkZip_putOemCodePage(objHandle: HCkZip; newPropVal: Integer); stdcall;

Sets the OEM code page to be used for Unicode filenames. This property defaults to the OEM code page of the computer.

top
OverwriteExisting
function CkZip_getOverwriteExisting(objHandle: HCkZip): wordbool; stdcall;
procedure CkZip_putOverwriteExisting(objHandle: HCkZip; newPropVal: wordbool); stdcall;

Determines whether existing files are overwritten during unzipping. The default is True, which means that already-existing files will be overwritten. Set this property = False to prevent existing files from being overwritten when unzipping.

top
PasswordProtect
function CkZip_getPasswordProtect(objHandle: HCkZip): wordbool; stdcall;
procedure CkZip_putPasswordProtect(objHandle: HCkZip; newPropVal: wordbool); stdcall;

True if the Zip should be password-protected using older Zip 2.0 encryption, commonly referred to as "password-protection".

This property is set when a zip archive is opened by any of the Open* methods, such as OpenZip, OpenFromMemory, etc.

top
PathPrefix
procedure CkZip_getPathPrefix(objHandle: HCkZip; outPropVal: HCkString); stdcall;
procedure CkZip_putPathPrefix(objHandle: HCkZip; newPropVal: PWideChar); stdcall;
function CkZip__pathPrefix(objHandle: HCkZip): PWideChar; stdcall;

A prefix that is added to each filename when zipping. One might set the PathPrefix to "subdir/" so that files are unzipped to a specified subdirectory when unzipping.

See the notes about PWideChar memory ownership and validity.

top
PercentDoneScale
function CkZip_getPercentDoneScale(objHandle: HCkZip): Integer; stdcall;
procedure CkZip_putPercentDoneScale(objHandle: HCkZip; newPropVal: Integer); stdcall;
Introduced in version 9.5.0.49

This property is only valid in programming environment and languages that allow for event callbacks.

Sets the value to be defined as 100% complete for the purpose of PercentDone event callbacks. The defaut value of 100 means that at most 100 event PercentDone callbacks will occur in a method that (1) is event enabled and (2) is such that it is possible to measure progress as a percentage completed. This property may be set to larger numbers to get more fine-grained PercentDone callbacks. For example, setting this property equal to 1000 will provide callbacks with .1 percent granularity. For example, a value of 453 would indicate 45.3% competed. This property is clamped to a minimum value of 10, and a maximum value of 100000.

top
PwdProtCharset
procedure CkZip_getPwdProtCharset(objHandle: HCkZip; outPropVal: HCkString); stdcall;
procedure CkZip_putPwdProtCharset(objHandle: HCkZip; newPropVal: PWideChar); stdcall;
function CkZip__pwdProtCharset(objHandle: HCkZip): PWideChar; stdcall;
Introduced in version 9.5.0.73

For older password-protected Zip archives (Zip 2.0 encryption), specifies the charset used for the binary representation of the decrypt password. The default value is "ansi". Other possible choices are cp850, cp437, or any of the code pages listed at the link below.

See the notes about PWideChar memory ownership and validity.

top
TempDir
procedure CkZip_getTempDir(objHandle: HCkZip; outPropVal: HCkString); stdcall;
procedure CkZip_putTempDir(objHandle: HCkZip; newPropVal: PWideChar); stdcall;
function CkZip__tempDir(objHandle: HCkZip): PWideChar; stdcall;

The temporary directory to use when unzipping files or writing a .zip (see the note below). When running in ASP or ASP.NET, the default value of TempDir is set to the directory where the .zip is being written. Set this property to override the default.

Note: When writing a .zip, a temp file is only used if overwriting an existing .zip. The reason is to prevent losing the existing .zip if something fails when writing the new .zip. If the new .zip is successfully written, then the existing .zip is replaced with the new .zip.

See the notes about PWideChar memory ownership and validity.

top
UncommonOptions
procedure CkZip_getUncommonOptions(objHandle: HCkZip; outPropVal: HCkString); stdcall;
procedure CkZip_putUncommonOptions(objHandle: HCkZip; newPropVal: PWideChar); stdcall;
function CkZip__uncommonOptions(objHandle: HCkZip): PWideChar; stdcall;
Introduced in version 9.5.0.84

This is a catch-all property to be used for uncommon needs. This property defaults to the empty string, and should typically remain empty.

Currently, the only possible option is "ForceZip64".

  • "ForceZip64" - Force the zip to be written with the Zip64 file format, even if not necessary.

See the notes about PWideChar memory ownership and validity.

top
VerboseLogging
function CkZip_getVerboseLogging(objHandle: HCkZip): wordbool; stdcall;
procedure CkZip_putVerboseLogging(objHandle: HCkZip; newPropVal: wordbool); stdcall;

If set to True, then the contents of LastErrorText (or LastErrorXml, or LastErrorHtml) may contain more verbose information. The default value is False. Verbose logging should only be used for debugging. The potentially large quantity of logged information may adversely affect peformance.

top
Version
procedure CkZip_getVersion(objHandle: HCkZip; outPropVal: HCkString); stdcall;
function CkZip__version(objHandle: HCkZip): PWideChar; stdcall;

Version of the component/library, such as "9.5.0.94"

See the notes about PWideChar memory ownership and validity.

More Information and Examples
top
Zipx
function CkZip_getZipx(objHandle: HCkZip): wordbool; stdcall;
procedure CkZip_putZipx(objHandle: HCkZip; newPropVal: wordbool); stdcall;

Starting in v9.4.1, Chilkat Zip will automatically unzip ZIPX files using any of the following compression methods: BZIP2, PPMd, LZMA, and Deflate64 ("Deflate64" is a trademark of PKWare, Inc.)

This property, however, controls whether or not a ZipX is automatically produced where the best compression algorithm for each file is automatically chosen based on file type. This property is for writing zip archives. It does not apply to when unzipping ZIPX archives, Chilkat Zip automatically handles the various compression algorithms when unzipping.

top
ZipxDefaultAlg
procedure CkZip_getZipxDefaultAlg(objHandle: HCkZip; outPropVal: HCkString); stdcall;
procedure CkZip_putZipxDefaultAlg(objHandle: HCkZip; newPropVal: PWideChar); stdcall;
function CkZip__zipxDefaultAlg(objHandle: HCkZip): PWideChar; stdcall;

The default compression algorithm to be used when creating ZIPX archives. The default value is "deflate". Other possible values are "ppmd", "lzma", "bzip2" and "deflate64". When writing a ZIPX archive, if the file extension does not indicate an obvious choice for the appropriate compression algorithm, then the ZipxDefaultAlg is used.

See the notes about PWideChar memory ownership and validity.

top

Methods

AddNoCompressExtension
procedure CkZip_AddNoCompressExtension(objHandle: HCkZip;
    fileExtension: PWideChar) stdcall;

Attempting to compress already-compressed data is usually a waste of CPU cycles with little or no benefit. In fact, it is possible that attempting to compress already-compressed data results in a slightly increased size. The Zip file format allows for files to be "stored" rather than compressed. This allows the file data to be streamed directly into a .zip without compression.

An instance of the Zip object has an internal list of "no compress" extensions. A filename with a "no compress" extension is "stored" rather than compressed. Additional "no compress" extensions may be added by calling this method (once per file extension). You should pass the file extension, such as ".xyz" in fileExtension.

"no compress" extensions may be removed by calling RemoveNoCompressExtension.

The default "no compress" extensions are: .zip, .gif, .jpg, .gz, .rar, .jar, .tgz, .bz2, .z, .rpm, .msi, .png

top
AppendBd
function CkZip_AppendBd(objHandle: HCkZip;
    pathInZip: PWideChar;
    byteData: HCkBinData): HCkZipEntry; stdcall;
Introduced in version 9.5.0.70

Appends the contents of byteData as a new entry to this zip object. The zip entry object containing the data is returned.

Returns nil on failure

top
AppendData
function CkZip_AppendData(objHandle: HCkZip;
    fileName: PWideChar;
    inData: HCkByteData): HCkZipEntry; stdcall;

Appends in-memory data as a new entry to a Zip object. The ZipEntry object containing the data is returned.

Note: This method only updates the zip object. To update (rewrite) a zip file, either the WriteZip or WriteZipAndClose method would need to be called.

Returns nil on failure

More Information and Examples
top
AppendDataEncoded
function CkZip_AppendDataEncoded(objHandle: HCkZip;
    filename: PWideChar;
    encoding: PWideChar;
    data: PWideChar): HCkZipEntry; stdcall;
Introduced in version 9.5.0.59

Appends in-memory data as a new entry to a Zip object. The filename is the filename of the entry as it will appear within the zip. The encoding is the encoding of the data, such as "base64", "hex", etc. The full list of encodings is listed at the web page linked below.

Returns the zip entry object.

Note: This method only updates the zip object. To update (rewrite) a zip file, either the WriteZip or WriteZipAndClose method would need to be called.

Returns nil on failure

More Information and Examples
top
AppendFiles
function CkZip_AppendFiles(objHandle: HCkZip;
    filePattern: PWideChar;
    recurse: wordbool): wordbool; stdcall;

Appends one or more files to the Zip object. The filePattern can use the "*" wildcard character for 0 or more of any characterSet recurse equal to True to recursively add all subdirectories, or False to only add files in the current directory.

Note: This method only updates the zip object. To update (rewrite) a zip file, either the WriteZip or WriteZipAndClose method would need to be called.

Returns True for success, False for failure.

top
AppendFilesAsync (1)
function CkZip_AppendFilesAsync(objHandle: HCkZip;
    filePattern: PWideChar;
    recurse: wordbool): HCkTask; stdcall;

Creates an asynchronous task to call the AppendFiles method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Note: Async method event callbacks happen in the background thread. Accessing and updating UI elements existing in the main thread may require special considerations.

Returns nil on failure

top
AppendFilesEx
function CkZip_AppendFilesEx(objHandle: HCkZip;
    filePattern: PWideChar;
    recurse: wordbool;
    saveExtraPath: wordbool;
    archiveOnly: wordbool;
    includeHidden: wordbool;
    includeSystem: wordbool): wordbool; stdcall;

Appends one or more files to the Zip object. The filePattern can use the "*" to mean 0 or more of any character. The recurse controls whether directories are recursively traversed. Set recurse equal to True to append files and subdirectories in the directory tree. Set recurse equal to False to add files only from the indicated directory.

The saveExtraPath only applies when the filePattern is an absolute path pattern, such as "C:/temp/abc/*.txt". If saveExtraPath is True, then the absolute path will be included in the zip entry filenames as relative paths. For example, "temp/abc/xyz.txt".

The archiveOnly, includeHidden, and includeSystem flags only apply when on the Windows operating system. If archiveOnly is True, then only files that have the archive bit set will be included in the zip. If includeHidden is False, then hidden files are not included. If includeSystem is False, then files having the System attribute are not included.

Note: This method does not write the zip archive. It simply adds references to the files that will be included in the .zip when the WriteZip or WriteZipAndClose methods are eventually called. Files and/or data may be added to the zip object by calling any combination of the Append* methods before finally writing the zip via one of the Write* methods.

Returns True for success, False for failure.

More Information and Examples
top
AppendFilesExAsync (1)
function CkZip_AppendFilesExAsync(objHandle: HCkZip;
    filePattern: PWideChar;
    recurse: wordbool;
    saveExtraPath: wordbool;
    archiveOnly: wordbool;
    includeHidden: wordbool;
    includeSystem: wordbool): HCkTask; stdcall;

Creates an asynchronous task to call the AppendFilesEx method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Note: Async method event callbacks happen in the background thread. Accessing and updating UI elements existing in the main thread may require special considerations.

Returns nil on failure

top
AppendNew
function CkZip_AppendNew(objHandle: HCkZip;
    fileName: PWideChar): HCkZipEntry; stdcall;

Appends a new and empty entry to the Zip object and returns the ZipEntry object. Data can be appended to the entry by calling ZipEntry.AppendData.

Important: To append an already-existing file, call the AppendOneFileOrDir method. The AppendNew method inserts a new and empty file entry within the Zip object. The purpose of AppendNew is to either create an empty file within the Zip, or to create a new file entry which can then be filled with data by calling the entry's AppendData method.

Note: This method only updates the zip object. To update (rewrite) a zip file, either the WriteZip or WriteZipAndClose method would need to be called.

Returns nil on failure

More Information and Examples
top
AppendNewDir
function CkZip_AppendNewDir(objHandle: HCkZip;
    dirName: PWideChar): HCkZipEntry; stdcall;

Adds an entry to the zip so that when it unzips, a new directory (with no files) is created. The directory does not need to exist on the local filesystem when calling this method. The dirName is simply a string that is used as the directory path for the entry added to the zip. The zip entry object is returned.

Note: This method only updates the zip object. To update (rewrite) a zip file, either the WriteZip or WriteZipAndClose method would need to be called.

Returns nil on failure

More Information and Examples
top
AppendOneFileOrDir
function CkZip_AppendOneFileOrDir(objHandle: HCkZip;
    fileOrDirPath: PWideChar;
    saveExtraPath: wordbool): wordbool; stdcall;

Appends a single file or directory to the Zip object. The saveExtraPath applies when fileOrDirPath is an absolute (non-relative) path. If saveExtraPath is True, then the absolute path is made relative and saved in the zip. For example, if the fileOrDirPath is "C:/temp/xyz/test.txt" and saveExtraPath is True, then the path in the zip will be "./temp/xyz/test.txt". If however, fileOrDirPath contains a relative path, then saveExtraPath has no effect.

Returns True for success, False for failure.

top
AppendOneFileOrDirAsync (1)
function CkZip_AppendOneFileOrDirAsync(objHandle: HCkZip;
    fileOrDirPath: PWideChar;
    saveExtraPath: wordbool): HCkTask; stdcall;

Creates an asynchronous task to call the AppendOneFileOrDir method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Note: Async method event callbacks happen in the background thread. Accessing and updating UI elements existing in the main thread may require special considerations.

Returns nil on failure

top
AppendSb
function CkZip_AppendSb(objHandle: HCkZip;
    pathInZip: PWideChar;
    sb: HCkStringBuilder;
    charset: PWideChar): wordbool; stdcall;
Introduced in version 10.0.0

Same as AppendString, but append the contents of of the sb, and allow the charset to be specified. The contents of sb is converted to charset before being added to the zip. The pathInZip is the path of the file that will be stored within the zip.

Note: This method only updates the zip object. To update (rewrite) a zip file, either the WriteZip or WriteZipAndClose method would need to be called.

Returns True for success, False for failure.

More Information and Examples
top
AppendString
function CkZip_AppendString(objHandle: HCkZip;
    internalZipFilepath: PWideChar;
    textData: PWideChar): HCkZipEntry; stdcall;

Adds an in-memory string to the Zip object. The textData argument is converted to the ANSI charset before being added to the Zip. If the Zip were written to disk by calling WriteZip, and later unzipped, the entry would unzip to an ANSI text file.

Note: This method only updates the zip object. To update (rewrite) a zip file, either the WriteZip or WriteZipAndClose method would need to be called.

Returns nil on failure

More Information and Examples
top
AppendString2
function CkZip_AppendString2(objHandle: HCkZip;
    internalZipFilepath: PWideChar;
    textData: PWideChar;
    charset: PWideChar): HCkZipEntry; stdcall;

Same as AppendString, but allows the charset to be specified. The textData is converted to charset before being added to the zip. The internalZipFilepath is the path of the file that will be stored within the zip.

Note: This method only updates the zip object. To update (rewrite) a zip file, either the WriteZip or WriteZipAndClose method would need to be called.

Returns nil on failure

More Information and Examples
top
AppendZip
function CkZip_AppendZip(objHandle: HCkZip;
    zipFileName: PWideChar): wordbool; stdcall;

Adds the contents of another existing Zip file to this Zip object.

Returns True for success, False for failure.

top
CloseZip
procedure CkZip_CloseZip(objHandle: HCkZip) stdcall;

Closes an open Zip file. This is identical to calling NewZip. (NewZip closes the current Zip file, if open, and initializes the Zip object to be empty. Zip files are only created when WriteZip is called.)

top
DeleteEntry
function CkZip_DeleteEntry(objHandle: HCkZip;
    entry: HCkZipEntry): wordbool; stdcall;

Removes a Zip entry from the calling Zip object.

Returns True for success, False for failure.

More Information and Examples
top
ExcludeDir
procedure CkZip_ExcludeDir(objHandle: HCkZip;
    dirName: PWideChar) stdcall;

Adds a directory name to be excluded when AppendFiles is called to add an entire directory tree. All directories having a name equal to an excluded directory will not be included when AppendFiles (or AppendFileEx) is called. Multiple directories can be excluded by calling ExcludeDir multiple times. The name comparison is case-insensitive.

top
ExtractExe
function CkZip_ExtractExe(objHandle: HCkZip;
    exePath: PWideChar;
    dirPath: PWideChar): wordbool; stdcall;
Introduced in version 9.5.0.44

Extracts files from a Chilkat produced self-extracting EXE into the specified directory. Subdirectories are automatically created as needed. If the self-extracting EXE is encrypted, be sure to set the DecryptPassword property prior to calling this method.

Returns True for success, False for failure.

top
ExtractExeAsync (1)
function CkZip_ExtractExeAsync(objHandle: HCkZip;
    exePath: PWideChar;
    dirPath: PWideChar): HCkTask; stdcall;
Introduced in version 9.5.0.44

Creates an asynchronous task to call the ExtractExe method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Note: Async method event callbacks happen in the background thread. Accessing and updating UI elements existing in the main thread may require special considerations.

Returns nil on failure

top
FirstEntry
function CkZip_FirstEntry(objHandle: HCkZip): HCkZipEntry; stdcall;

Return the first entry in the Zip. Call ZipEntry.NextEntry to iterate over the entries in a Zip until a NULL is returned.

Returns nil on failure

More Information and Examples
top
FirstMatchingEntry
function CkZip_FirstMatchingEntry(objHandle: HCkZip;
    pattern: PWideChar): HCkZipEntry; stdcall;

Returns the first entry having a filename matching a pattern. The "*" characters matches 0 or more of any character. The full filename, including path, is used when matching against the pattern. A NULL is returned if nothing matches.

Returns nil on failure

More Information and Examples
top
GetDirectoryAsXML
function CkZip_GetDirectoryAsXML(objHandle: HCkZip;
    outXml: HCkString): wordbool; stdcall;
function CkZip__getDirectoryAsXML(objHandle: HCkZip): PWideChar; stdcall;

Return the contents of the Zip file directory in an XML formatted string

Returns True for success, False for failure.

See the notes about PWideChar memory ownership and validity.

top
GetEntryByID
function CkZip_GetEntryByID(objHandle: HCkZip;
    entryID: Integer): HCkZipEntry; stdcall;

Retrieves a ZipEntry by ID. Chilkat Zip.NET automatically assigns a unique ID to each ZipEntry in the Zip. This feature makes it easy to associate an item in a UI control with a ZipEntry.

Returns nil on failure

top
GetEntryByIndex
function CkZip_GetEntryByIndex(objHandle: HCkZip;
    index: Integer): HCkZipEntry; stdcall;

Retrieves a ZipEntry by index. The first entry is at index 0. This will return directory entries as well as files.

Returns nil on failure

More Information and Examples
top
GetEntryByName
function CkZip_GetEntryByName(objHandle: HCkZip;
    entryName: PWideChar): HCkZipEntry; stdcall;

Returns a ZipEntry by filename. If a full or partial path is part of the filename, this must be included in the entryName. Zip archives generally use forward slashes for directory separators. Use a forward slashes instead of backslash chars conventionally used in Windows.

Returns nil on failure

top
GetExclusions
function CkZip_GetExclusions(objHandle: HCkZip): HCkStringArray; stdcall;

Returns the current collection of exclusion patterns that have been set by SetExclusions.

Returns nil on failure

top
GetExeConfigParam
function CkZip_GetExeConfigParam(objHandle: HCkZip;
    name: PWideChar;
    outStr: HCkString): wordbool; stdcall;
function CkZip__getExeConfigParam(objHandle: HCkZip;
    name: PWideChar): PWideChar; stdcall;

(Relevant only when running on a Microsoft Windows operating system.) Gets the value of an EXE config param as described in the ExeXmlConfig property.

Returns True for success, False for failure.

See the notes about PWideChar memory ownership and validity.

top
GetMaxUncompressedSize
function CkZip_GetMaxUncompressedSize(objHandle: HCkZip;
    outStr: HCkString): wordbool; stdcall;
function CkZip__getMaxUncompressedSize(objHandle: HCkZip): PWideChar; stdcall;
Introduced in version 9.5.0.96

Returns the size of the file contained within the Zip that has the largest uncompressed size. The size is returned in string form because it could be larger than what can be held in a 32-bit unsigned integer, and we leave it to the application to convert the string to an integer number. (If necessary. Perhaps your application is only interested in the order of magnitude, which can be known by the length of the string.)

Returns True for success, False for failure.

See the notes about PWideChar memory ownership and validity.

top
IsNoCompressExtension
function CkZip_IsNoCompressExtension(objHandle: HCkZip;
    fileExtension: PWideChar): wordbool; stdcall;

Returns True if the fileExtension is contained in the set of "no compress" extensions, otherwise returns False. (See the documentation for the AddNoCompressExtension method.) The fileExtension may be passed with or without the ".". For example, both ".jpg" and "jpg" are acceptable.

top
IsPasswordProtected
function CkZip_IsPasswordProtected(objHandle: HCkZip;
    zipFilename: PWideChar): wordbool; stdcall;

Return True if a Zip file is password protected

top
LoadTaskCaller
function CkZip_LoadTaskCaller(objHandle: HCkZip;
    task: HCkTask): wordbool; stdcall;
Introduced in version 9.5.0.80

Loads the caller of the task's async method.

Returns True for success, False for failure.

top
NewZip
function CkZip_NewZip(objHandle: HCkZip;
    zipFilePath: PWideChar): wordbool; stdcall;

Clears and initializes the contents of the Zip object. If a Zip file was open, it is closed and all entries are removed from the object. The FileName property is set to the zipFilePath argument.

More Information and Examples
top
OpenBd
function CkZip_OpenBd(objHandle: HCkZip;
    binData: HCkBinData): wordbool; stdcall;
Introduced in version 9.5.0.66

Open a Zip contained in binData.

When a zip is opened, the PasswordProtect and Encryption properties will be appropriately set. If the zip is password protected (i.e. uses older Zip 2.0 encrypion), then the PasswordProtect property will be set to True. If the zip is strong encrypted, the Encryption property will be set to a value 1 through 4, where 4 indicates WinZip compatible AES encryption.

Returns True for success, False for failure.

More Information and Examples
top
OpenEmbedded
function CkZip_OpenEmbedded(objHandle: HCkZip;
    exeFilename: PWideChar;
    resourceName: PWideChar): wordbool; stdcall;

(Relevant only when running on a Microsoft Windows operating system.) Opens a Zip embedded in an MS Windows EXE

Returns True for success, False for failure.

top
OpenFromByteData
function CkZip_OpenFromByteData(objHandle: HCkZip;
    byteData: HCkByteData): wordbool; stdcall;

Same as OpenFromMemory.

When a zip is opened, the PasswordProtect and Encryption properties will be appropriately set. If the zip is password protected (i.e. uses older Zip 2.0 encrypion), then the PasswordProtect property will be set to True. If the zip is strong encrypted, the Encryption property will be set to a value 1 through 4, where 4 indicates WinZip compatible AES encryption.

Returns True for success, False for failure.

top
OpenFromMemory
function CkZip_OpenFromMemory(objHandle: HCkZip;
    inData: HCkByteData): wordbool; stdcall;

Open a Zip that is completely in-memory. This allows for Zip files to be opened from non-filesystem sources, such as a database.

When a zip is opened, the PasswordProtect and Encryption properties will be appropriately set. If the zip is password protected (i.e. uses older Zip 2.0 encrypion), then the PasswordProtect property will be set to True. If the zip is strong encrypted, the Encryption property will be set to a value 1 through 4, where 4 indicates WinZip compatible AES encryption.

Returns True for success, False for failure.

top
OpenZip
function CkZip_OpenZip(objHandle: HCkZip;
    zipPath: PWideChar): wordbool; stdcall;

Opens a Zip archive. Encrypted and password-protected zips may be opened without providing the password, but their contents may not be unzipped unless the correct password is provided via the DecryptPassword proprety, or the SetPassword method.

When a zip is opened, the PasswordProtect and Encryption properties will be appropriately set. If the zip is password protected (i.e. uses older Zip 2.0 encrypion), then the PasswordProtect property will be set to True. If the zip is strong encrypted, the Encryption property will be set to a value 1 through 4, where 4 indicates WinZip compatible AES encryption.

Returns True for success, False for failure.

More Information and Examples
top
OpenZipAsync (1)
function CkZip_OpenZipAsync(objHandle: HCkZip;
    zipPath: PWideChar): HCkTask; stdcall;

Creates an asynchronous task to call the OpenZip method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Note: Async method event callbacks happen in the background thread. Accessing and updating UI elements existing in the main thread may require special considerations.

Returns nil on failure

top
QuickAppend
function CkZip_QuickAppend(objHandle: HCkZip;
    ZipFileName: PWideChar): wordbool; stdcall;

Efficiently appends additional files to an existing zip archive. QuickAppend leaves all entries in the existing .zip untouched. It operates by appending new files and updating the internal "central directory" of the zip archive.

Returns True for success, False for failure.

top
QuickAppendAsync (1)
function CkZip_QuickAppendAsync(objHandle: HCkZip;
    ZipFileName: PWideChar): HCkTask; stdcall;

Creates an asynchronous task to call the QuickAppend method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Note: Async method event callbacks happen in the background thread. Accessing and updating UI elements existing in the main thread may require special considerations.

Returns nil on failure

top
RemoveNoCompressExtension
procedure CkZip_RemoveNoCompressExtension(objHandle: HCkZip;
    fileExtension: PWideChar) stdcall;

Removes a file extension from the zip object's internal list of "no compress" extensions. (For more information, see AddNoCompressExtension.)

top
SetCompressionLevel
procedure CkZip_SetCompressionLevel(objHandle: HCkZip;
    level: Integer) stdcall;

Sets the compression level for all file and data entries. The compression level for a mapped entry (i.e. an entry that is contained within an opened .zip, cannot be changed.) The default compression level is 6. A compression level of 0 is equivalent to no compression. The maximum compression level is 9.

The zip.SetCompressionLevel method must be called after appending the files (i.e. after the calls to AppendFile*, AppendData, or AppendOneFileOrDir).

A single call to SetCompressionLevel will set the compression level for all existing file and data entries.

top
SetExclusions
procedure CkZip_SetExclusions(objHandle: HCkZip;
    excludePatterns: HCkStringArray) stdcall;

Specify a collection of exclusion patterns to be used when adding files to a Zip. Each pattern in the collection can use the "*" wildcard character, where "*" indicates 0 or more occurrences of any character.

top
SetExeConfigParam
procedure CkZip_SetExeConfigParam(objHandle: HCkZip;
    paramName: PWideChar;
    paramValue: PWideChar) stdcall;

Sets a self-extractor property that is embedded in the resultant EXE created by the WriteExe or WriteExe2 methods. The paramName is one of the XML tags listed in the ExeXmlConfig property.

For example, to specify the text for the self-extractor's main dialog unzip button, paramName would be "MainUnzipBtn".

top
SetPassword
procedure CkZip_SetPassword(objHandle: HCkZip;
    password: PWideChar) stdcall;

Set the password for an encrypted or password-protected Zip.

Note: The SetPassword method has the effect of setting both the EncryptPassword property as well as the DecryptPassword property. The SetPassword method should no longer be used. It has been replaced by the DecryptPassword and EncryptPassword properties to make it possible to open an encrypted zip and re-write it with a new password.

top
Unzip
function CkZip_Unzip(objHandle: HCkZip;
    dirPath: PWideChar): Integer; stdcall;

Unzips and returns the number of files unzipped, or -1 if a failure occurs. Subdirectories are automatically created during the unzipping process.

More Information and Examples
top
UnzipAsync (1)
function CkZip_UnzipAsync(objHandle: HCkZip;
    dirPath: PWideChar): HCkTask; stdcall;

Creates an asynchronous task to call the Unzip method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Note: Async method event callbacks happen in the background thread. Accessing and updating UI elements existing in the main thread may require special considerations.

Returns nil on failure

top
UnzipInto
function CkZip_UnzipInto(objHandle: HCkZip;
    dirPath: PWideChar): Integer; stdcall;

Unzips and returns the number of files unzipped, or -1 if a failure occurs. All files in the Zip are unzipped into the specfied dirPath regardless of the directory path information contained in the Zip. This has the effect of collapsing all files into a single directory. If several files in the Zip have the same name, the files unzipped last will overwrite the files already unzipped.

top
UnzipIntoAsync (1)
function CkZip_UnzipIntoAsync(objHandle: HCkZip;
    dirPath: PWideChar): HCkTask; stdcall;

Creates an asynchronous task to call the UnzipInto method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Note: Async method event callbacks happen in the background thread. Accessing and updating UI elements existing in the main thread may require special considerations.

Returns nil on failure

top
UnzipMatching
function CkZip_UnzipMatching(objHandle: HCkZip;
    dirPath: PWideChar;
    pattern: PWideChar;
    verbose: wordbool): Integer; stdcall;

Same as Unzip, but only unzips files matching a pattern. If no wildcard characters ('*') are used, then only files that exactly match the pattern will be unzipped. The "*" characters matches 0 or more of any character.

More Information and Examples
top
UnzipMatchingAsync (1)
function CkZip_UnzipMatchingAsync(objHandle: HCkZip;
    dirPath: PWideChar;
    pattern: PWideChar;
    verbose: wordbool): HCkTask; stdcall;

Creates an asynchronous task to call the UnzipMatching method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Note: Async method event callbacks happen in the background thread. Accessing and updating UI elements existing in the main thread may require special considerations.

Returns nil on failure

top
UnzipMatchingInto
function CkZip_UnzipMatchingInto(objHandle: HCkZip;
    dirPath: PWideChar;
    pattern: PWideChar;
    verbose: wordbool): Integer; stdcall;

Unzips matching files into a single directory, ignoring all path information stored in the Zip.

top
UnzipMatchingIntoAsync (1)
function CkZip_UnzipMatchingIntoAsync(objHandle: HCkZip;
    dirPath: PWideChar;
    pattern: PWideChar;
    verbose: wordbool): HCkTask; stdcall;

Creates an asynchronous task to call the UnzipMatchingInto method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Note: Async method event callbacks happen in the background thread. Accessing and updating UI elements existing in the main thread may require special considerations.

Returns nil on failure

top
UnzipNewer
function CkZip_UnzipNewer(objHandle: HCkZip;
    dirPath: PWideChar): Integer; stdcall;

Same as Unzip, but only files that don't already exist on disk, or have later file modification dates are unzipped.

top
UnzipNewerAsync (1)
function CkZip_UnzipNewerAsync(objHandle: HCkZip;
    dirPath: PWideChar): HCkTask; stdcall;

Creates an asynchronous task to call the UnzipNewer method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Note: Async method event callbacks happen in the background thread. Accessing and updating UI elements existing in the main thread may require special considerations.

Returns nil on failure

top
VerifyPassword
function CkZip_VerifyPassword(objHandle: HCkZip): wordbool; stdcall;

Tests the current DecryptPassword setting against the currently opened zip. Returns True if the password is valid, otherwise returns False.

More Information and Examples
top
WriteBd
function CkZip_WriteBd(objHandle: HCkZip;
    binData: HCkBinData): wordbool; stdcall;
Introduced in version 9.5.0.66

Same as WriteZip, but instead of writing the Zip to a file, it writes to binData. Zips that are written to binData can be opened by calling OpenBd. Note: Both WriteBd and OpenBd are added in Chilkat v9.5.0.66

Returns True for success, False for failure.

More Information and Examples
top
WriteBdAsync (1)
function CkZip_WriteBdAsync(objHandle: HCkZip;
    binData: HCkBinData): HCkTask; stdcall;
Introduced in version 9.5.0.66

Creates an asynchronous task to call the WriteBd method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Note: Async method event callbacks happen in the background thread. Accessing and updating UI elements existing in the main thread may require special considerations.

Returns nil on failure

top
WriteExe
function CkZip_WriteExe(objHandle: HCkZip;
    exeFilename: PWideChar): wordbool; stdcall;

(Relevant only when running on a Microsoft Windows operating system.) Writes an MS-Windows self-extracting executable. There are no limitations on the total size, individual file size, or number of files that can be added to a self-extracting EXE.

If the resultant EXE will automatically accept these command-line arguments when run:

-log logFileName
Creates a log file that lists the settings embedded within the EXE and logs the errors, warnings, and other information about the self-extraction.
-unzipDir unzipDirectoryPath
Unzips to this directory path without user intervention. (UNC paths, such as \\servername\path, are not supported.)
-pwd password
Specifies the password for an encrypted EXE
-ap autoRunParams
Specifies the command line parameters to be passed to the AutoRun executable (embedded within the EXE).

Returns True for success, False for failure.

top
WriteExeAsync (1)
function CkZip_WriteExeAsync(objHandle: HCkZip;
    exeFilename: PWideChar): HCkTask; stdcall;

Creates an asynchronous task to call the WriteExe method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Note: Async method event callbacks happen in the background thread. Accessing and updating UI elements existing in the main thread may require special considerations.

Returns nil on failure

top
WriteExeToMemory
function CkZip_WriteExeToMemory(objHandle: HCkZip;
    outBytes: HCkByteData): wordbool; stdcall;

(Relevant only when running on a Microsoft Windows operating system.) Same as WriteExe, but instead of writing a file, the MS-Windows EXE is written to memory.

Returns True for success, False for failure.

top
WriteExeToMemoryAsync (1)
function CkZip_WriteExeToMemoryAsync(objHandle: HCkZip): HCkTask; stdcall;

Creates an asynchronous task to call the WriteExeToMemory method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Note: Async method event callbacks happen in the background thread. Accessing and updating UI elements existing in the main thread may require special considerations.

Returns nil on failure

top
WriteToMemory
function CkZip_WriteToMemory(objHandle: HCkZip;
    outData: HCkByteData): wordbool; stdcall;

Same as WriteZip, but instead of writing the Zip to a file, it writes to memory. Zips that are written to memory can also be opened from memory by calling OpenFromMemory.

Returns True for success, False for failure.

More Information and Examples
top
WriteToMemoryAsync (1)
function CkZip_WriteToMemoryAsync(objHandle: HCkZip): HCkTask; stdcall;

Creates an asynchronous task to call the WriteToMemory method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Note: Async method event callbacks happen in the background thread. Accessing and updating UI elements existing in the main thread may require special considerations.

Returns nil on failure

top
WriteZip
function CkZip_WriteZip(objHandle: HCkZip): wordbool; stdcall;

Saves the Zip to a file and implictly re-opens it so further operations can continue. Use WriteZipAndClose to write and close the Zip. There is no limitation on the size of files that may be contained within a .zip, the total number of files in a .zip, or the total size of a .zip. If necessary, WriteZip will use the ZIP64 file format extensions when 4GB or file count limitations of the old zip file format are exceeded.

Returns True for success, False for failure.

More Information and Examples
top
WriteZipAsync (1)
function CkZip_WriteZipAsync(objHandle: HCkZip): HCkTask; stdcall;

Creates an asynchronous task to call the WriteZip method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Note: Async method event callbacks happen in the background thread. Accessing and updating UI elements existing in the main thread may require special considerations.

Returns nil on failure

top
WriteZipAndClose
function CkZip_WriteZipAndClose(objHandle: HCkZip): wordbool; stdcall;

Saves the Zip to a file and closes it. On return, the Zip object will be in the state as if NewZip had been called. There is no limitation on the size of files that may be contained within a .zip, the total number of files in a .zip, or the total size of a .zip. If necessary, WriteZip will use the ZIP64 file format extensions when 4GB or file count limitations of the old zip file format are exceeded.

Returns True for success, False for failure.

More Information and Examples
top
WriteZipAndCloseAsync (1)
function CkZip_WriteZipAndCloseAsync(objHandle: HCkZip): HCkTask; stdcall;

Creates an asynchronous task to call the WriteZipAndClose method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Note: Async method event callbacks happen in the background thread. Accessing and updating UI elements existing in the main thread may require special considerations.

Returns nil on failure

top

Events

Chilkat supports event callbacks for the Delphi DLL starting in version 9.5.0.82.

AbortCheck
function MyAbortCheck(): Integer; cdecl;
Introduced in version 9.5.0.82

Provides the opportunity for a method call to be aborted. The AbortCheck event is fired periodically based on the value of the HeartbeatMs property. If HeartbeatMs is 0, then no AbortCheck events will fire. As an example, to fire 5 AbortCheck events per second, set the HeartbeatMs property equal to 200. Return True to abort; return False to continue (not abort)

More Information and Examples
top
PercentDone
function MyPercentDone(pctDone: Integer): Integer; cdecl;
Introduced in version 9.5.0.82

Provides the percentage completed for any method that involves network communications or time-consuming processing (assuming it is a method where a percentage completion can be measured). This event is only fired when it is possible to know a percentage completion, and when it makes sense to express the operation as a percentage completed. The pctDone argument will have a value from 1 to 100. For operations (Chilkat method calls) that complete very quickly, the number of PercentDone callbacks will vary, but the final callback should have a value of 100. For long running operations, no more than one callback per percentage point will occur (for example: 1, 2, 3, ... 98, 99, 100).

The PercentDone callback counts as an AbortCheck event. For method calls that complete quickly such that PercentDone events fire, it may be that AbortCheck events don't fire because the opportunity to abort is already provided in the PercentDone callback. For time consuming operations, where the amount of time between PercentDone callbacks are long, AbortCheck callbacks may be used to allow for the operation to be aborted in a more responsive manner.

Return True to abort; return False to continue (not abort)

More Information and Examples
top
ProgressInfo
procedure MyProgressInfo(name: PWideChar; value: PWideChar) cdecl;
Introduced in version 9.5.0.82

A general name/value event that provides information about what is happening during a method call. To find out what information is available, write code to handle this event and log the name/value pairs. Most are self-explanatory.

More Information and Examples
top
TaskCompleted
procedure MyTaskCompleted(task: HCkTask) cdecl;
Introduced in version 9.5.0.82

Called in the background thread when an asynchronous task completes.

top