Codex API: Archives


The CreateSingularArchives function creates archives which are allowed to contain a single compressed file.

This function is designed to compress multiple files into multiple output archives.


VOID CreateSingularArchives(
    LPCTSTR lpArchiveType,    // archive type to create
    LPCTSTR lpPath,           // output path
    LPCTSTR lpFiles,          // files to compress
    LPCTSTR lpProfile         // compression profile to use



[in] Pointer to a null-terminated string that specifies the type of archive to create.

The lpArchive parameter must include the archive extension only. The extension may include wildcards.

Use the GetCompressibleArchivesEx function to obtain a list of archive types supported for compression.


[in] Pointer to a null-terminated string specifying the output path for the new archives. UNC paths are accepted.

Pass NULL in this parameter to indicate that new archives must be created in the same folder(s) as the files being archived. This is useful when archiving files in different folders and when the output must fall in the same respective folders.


[in] Pointer to a null-terminated string formatted as COMMATEXT specifying the list of files to compress non-recursively. UNC paths are accepted.

Wildcards are NOT accepted.


[in] Pointer to a null-terminated string specifying the compression profile to use. Use the GetCompressionProfilesEx function to obtain a list of available profiles by each archive type.

The indicated profile must exist.

It is recommended that you only use the "Default" profile, which is guaranteed to exist if the archive is compressible.

Return Values

This function does not return any values.


CreateSingularArchives invokes the compression plug-in mapped to the given archive type, starting with the first file in the lpFiles parameter. Once the first archive has been created, CreateSingularArchives invokes the plug-in again, until all source files specified in the lpFiles parameter have been exhausted.

The plug-in is responsible for displaying progress and feedback to the user during this entire process. The plug-in must also handle error conditions.

is most suitable for archive types such as GZIP or BZIP2, which allow only a single file to be present inside an archive. To compress multiple files into a single archive, use the CreateMergedArchive function instead.


Windows NT/2000/XP: Requires Windows NT 4.0 SP4 or later.
Windows 95/98/Me:
Requires Windows 98 (or Windows 95 with DCOM 1.2).
Declared in mCodexAPI.h.
Use mCodexAPI.dll.

See Also

Codex API Overview, Codex API Functions, GetCompressibleArchivesEx, GetCompressionProfilesEx, CreateMergedArchives, ExtractArchive, COMMATEXT