Codex API: Archives


The ViewUpdateArchive function views a file inside an archive. If the viewed file has changed when the viewer exists, the archive may be updated with the new file.


VOID ViewUpdateArchive(
    LPCTSTR lpArchive,   // archive to view/update
    LPCTSTR lpItem,      // file to view/update
    BOOL bPrompt         // prompt for update



[in] Pointer to a null-terminated string that specifies the full path of the archive containing the item to view.

To enable viewing, the archive must be supported for decompression. Use the GetExtractableArchivesEx function to obtain a list of archives supported for decompression. Furthermore, a "Structured" decompression profile must exist for the archive. Use the GetExtractionProfilesEx function to obtain a list of supported decompression profiles for the archive.

To enable updating of changed viewed items, the archive must be supported for compression. Use the GetCompressibleArchivesEx function to obtain a list of archives supported for compression. Furthermore, a "Structured" compression profile must exist for the archive. Use the GetCompressionProfilesEx function to obtain a list of supported compression profiles for the archive.


[in] Pointer to a null-terminated string specifying the file inside the archive to be viewed/updated.

If the file is stored inside the archive with path information, lpItem must include that exact path information.

Only a single file may be viewed at a time.


[in] Specifies if the update should be performed automatically, or the user should be asked before updating.

If bPrompt is TRUE and the viewed item has been changed, the user will be prompted on whether to update the archive with the modified item. If bPrompt is FALSE and the viewed item has been changed, the archive will be automatically updated.

If the viewed item has not changed, or the archive type does not support updating, this parameter has no effect.

Return Values

This function does not return any values.


ViewUpdateArchive first invokes the decompression plug-in mapped to the given archive type and extracts the selected item to a temporary folder. The plug-in is responsible for displaying progress and feedback to the user. The plug-in must also handle error conditions.

After extraction, ViewUpdateArchive finds the associated application with the extracted item and opens the item with this application. If an associated application cannot be found, ViewUpdateArchive uses the default viewer instead. See the SetGenericViewer function for information on configuring the default viewer.

After the viewer application exits, if the file time of the item remains the same, ViewUpdateArchive returns. Otherwise, if present, the compression plug-in mapped to the archive is invoked and the updated item recompressed into the archive. Again, the compression plug-in displays progress and handles errors.


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, GetExtractableArchivesEx, GetExtractionProfilesEx, GetCompressibleArchivesEx, GetCompressionProfilesEx, SetGenericViewer