ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Standard functions / Archive functions
  • Example 1: Adding a file into an archive
  • Example 2: Adding a file into an archive while displaying a progress bar
zipAddFile (Example)
Example 1: Adding a file into an archive
Reportes y Consultas The following code is used to add a file into an archive. The file is selected by the user with fSelect. The full path of the file is stored in the archive.
// Declare and initialize the variables
FileName is string
ArchiveName is string = "MyArchive"
ErrorCodeCreation is int
ErrorCodeAddition is int
 
// Create an archive
// WINDEV code
ErrorCodeCreation = zipCreate(ArchiveName, "C:\MyDirectory\MyArchives\PdfArchive.wdz")
// WINDEV Mobile code
ErrorCodeCreation = zipCreate(ArchiveName, "\MyDirectory\MyArchives\PdfArchive.zip")
// Display an error message if the archive was not created
IF ErrorCodeCreation = 0 THEN
// Select the file to add
FileName = fSelect("", "", "File to add", ...
  "File to compress" + TAB + "*.*", "*" , fselOpen + fselExist)
// Add the selected file into the archive
ErrorCodeAddition = zipAddFile(ArchiveName, FileName, zipDrive)
// Display an error message if the file was not added
IF ErrorCodeAddition <> 0 THEN
Error(zipMsgError(ErrorCodeAddition))
END
ELSE
Error(zipMsgError(ErrorCodeCreation))
END
Example 2: Adding a file into an archive while displaying a progress bar
Minimum version required
  • Version 9
Comments
Click [Add] to post a comment

Last update: 05/26/2022

Send a report | Local help