AYUDA EN LÍNEA
 WINDEVWEBDEV Y WINDEV MOBILE

Ayuda / WLanguage / Funciones WLanguage / Funciones estándar / Funciones de archivos
  • Displaying the files currently extracted
zipCurrentFile (Example)
Displaying the files currently extracted
WINDEVCódigo de Usuario (UMC) 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 PROCEDURE 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
Versión mínima requerida
  • Versión 9
Esta página también está disponible para…
Comentarios
Haga clic en [Agregar] para publicar un comentario

Última modificación: 27/05/2022

Señalar un error o enviar una sugerencia | Ayuda local