PC SOFT

WINDEVWEBDEV AND WINDEV MOBILE
ONLINE HELP

Home | Sign in | English UK
  • 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
Reports and Queries 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
This page is also available for…
Comments
Click [Add] to post a comment