PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN
  • Displaying the files currently extracted
zipCurrentFile (Example)
Displaying the files currently extracted
WINDEVWEBDEV - Server codeReports and QueriesUser code (UMC)Ajax The following code is used to display, in the status bar of the window, the name of the files currently extracted.
// --Global declarations
GLOBAL
ArchiveName is string = "MyArchive"
// --Click on BTN_ExtractFile
// Initialization
DirectoryName is string
CurrentFile is string
CreationErrorCode is int
AdditionErrorCode is int
ErrorCodeExtract is int
 
// Create an archive
CreationErrorCode = zipCreate(ArchiveName, "C:\Directory\Archives\ArchivePdf.zip")
 
IF CreationErrorCode = 0 THEN
// Select the directory
DirectoryName = fSelectDir("", "", "Directory to add")
// Add all the files found in the selected directory
// and subdirectories to the archive
AdditionErrorCode = zipAddDirectory(ArchiveName, DirectoryName, True, zipDirectory)
IF AdditionErrorCode = 0 THEN
// Extract and decompress the files into the current directory
ErrorCodeExtract = zipExtractAll(ArchiveName, zipDirectory, Compression_ProgressBar)
IF ErrorCodeExtract <> 0 THEN
// Display the name of the file if an error occurred during the extraction
CurrentFile = zipCurrentFile(ArchiveName)
Error(zipMsgError(ErrorCodeExtract) + "on file" + CurrentFile)
END
ELSE
 // Display an error message if the files have not been added
 Error(zipMsgError(AdditionErrorCode))
END
ELSE
// Display an error message if the archive was not created
Error(zipMsgError(CreationErrorCode))
END
 
// Internal procedure used for the progress bar.
INTERNAL PROCÉDURE Compression_ProgressBar(CurrentFile is string, Percentage is int)
IF Percentage < 100 THEN
ProgressBar(Percentage, 100, CurrentFile)
// Refresh the window
Multitask(-1)
ELSE
// The compression is over
ProgressBar()
END
END
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment