PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • Error codes
  • Extracted file
  • Progress bar
  • Extraction on diskettes from a multi-part archive
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Extracts all files from an archive and decompresses them.
The archive used can be in CAB, RAR, ZIP, WDZ, 7z, TAR or TGZ (TAR.GZ) format.
Versions 15 and later
Android This function is now available for the Android applications.
New in version 15
Android This function is now available for the Android applications.
Android This function is now available for the Android applications.
Versions 17 and later
iPhone/iPad This function is now available for the iPhone/iPad applications.
New in version 17
iPhone/iPad This function is now available for the iPhone/iPad applications.
iPhone/iPad This function is now available for the iPhone/iPad applications.
Versions 18 and later
Android Widget This function is now available in Android Widget mode.
WINDEVWEBDEV - Server codeWindows This function now supports the 7z format.
New in version 18
Android Widget This function is now available in Android Widget mode.
WINDEVWEBDEV - Server codeWindows This function now supports the 7z format.
Android Widget This function is now available in Android Widget mode.
WINDEVWEBDEV - Server codeWindows This function now supports the 7z format.
Versions 19 and later
Universal Windows 10 App This function is now available in Windows Store apps mode.
New in version 19
Universal Windows 10 App This function is now available in Windows Store apps mode.
Universal Windows 10 App This function is now available in Windows Store apps mode.
Versions 21 and later
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
WINDEVWEBDEV - Server codeWindowsLinuxiPhone/iPadUniversal Windows 10 App This function now supports the TAR and TGZ (TAR.GZ) formats.
New in version 21
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
WINDEVWEBDEV - Server codeWindowsLinuxiPhone/iPadUniversal Windows 10 App This function now supports the TAR and TGZ (TAR.GZ) formats.
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
WINDEVWEBDEV - Server codeWindowsLinuxiPhone/iPadUniversal Windows 10 App This function now supports the TAR and TGZ (TAR.GZ) formats.
WINDEVWEBDEV - Server codeReports and QueriesJavaAjaxUser code (UMC)
// Open an archive
ResOpenArchive = zipOpen("Archive", "C:\Archives\Archive.zip")

IF ResOpenArchive = 0 THEN
...
// Extract all files from the archive
ResExtractAll = zipExtractAll("Archive", zipDrive)
...
END
Windows Mobile
// Open an archive
ResOpenArchive = zipOpen("Archive", "\Archives\Archive.zip")
IF ResOpenArchive = 0 THEN
...
// Extract all files from the archive
ResExtractAll = zipExtractAll("Archive")
...
END
Syntax
<Result> = zipExtractAll(<Archive> [, <Destination of Files> [, <Options>] [, <WLanguage Procedure>] , [ <Management of Progress Bar>]])
<Result>: Integer
  • 0 if the files have been extracted,
  • An error code (value greater than 0) otherwise. See the Notes for more details.
<Archive>: Character string (with quotes) or zipArchive variable
Name of archive to use.
This name can correspond to:
<Destination of Files>: Optional character string or constant
Destination path of extracted files:
  • Optional character string: The files are extracted into the specified path to which is added the tree structure of each file (the disk is not stored). The specified path is created if it does not exist.
    Universal Windows 10 App The destination path of extracted file must correspond to the working directory of application (returned by fDataDir) or to one of its sub-directories.
  • Optional constant:
    zipDriveExtraction:
    • to the initial file location if it was stored and if the drive exists.
    • while restoring the tree structure of the file on the current drive if the drive or the stored directory does not exist.
    • into the current directory if only the file name and extension have been stored.
    Note: If the zipDrive constant is used, the WDZ format stores the full path of the file (including the drive letter) while the ZIP format does not store the drive letter.
    LinuxiPhone/iPad This constant is not available. The directories have no root.
    AndroidAndroid Widget Java This constant and zipDirectory will have the same effect
    Archives in 7z format: This constant and zipDirectory will have the same effect.
    zipDirectoryExtraction into the current directory while restoring the tree structure of file (if it was stored).
    zipOverwriteDuring the extraction, the existing read-only files are automatically overwritten by the extracted files. This constant can be combined with the zipDrive and zipDirectory constants.
    AndroidAndroid Widget Java This constant is not available.

Windows Mobile These constants cannot be used because the notion of current directory is not supported by the Pocket PC.

Universal Windows 10 App These constants cannot be used.
<Options>: Optional constant
Configure the extraction (if <Destination of Files> corresponds to a character string):
zipOverwriteDuring the extraction, the existing read-only files are automatically overwritten by the extracted files.
AndroidAndroid Widget Java This constant is not available.
<WLanguage Procedure>: Optional character string
Versions 19 and later
Name of the WLanguage procedure that will be called if an error occurs when extracting files.
CAUTION: This parameter can be used only if <Archive> corresponds to a zipArchive variable.
This procedure has the following format:
PROCEDURE ProcedureName (<Error Code>, <File Name>)
where:
  • <Error Code> is an integer corresponding to the code of the error that occurred when extracting the file.
  • <File Name> is a character string containing the path of the file processed by zipExtractAll.
The procedure can return one of the following constants:
zipCancelCancels the extraction of files from the archive.
zipIgnoreIgnores the file in error.
zipRetryRetries the file extraction.
WEBDEV - Server code This procedure must be a server procedure.
AndroidAndroid Widget Java This parameter is not allowed.
New in version 19
Name of the WLanguage procedure that will be called if an error occurs when extracting files.
CAUTION: This parameter can be used only if <Archive> corresponds to a zipArchive variable.
This procedure has the following format:
PROCEDURE ProcedureName (<Error Code>, <File Name>)
where:
  • <Error Code> is an integer corresponding to the code of the error that occurred when extracting the file.
  • <File Name> is a character string containing the path of the file processed by zipExtractAll.
The procedure can return one of the following constants:
zipCancelCancels the extraction of files from the archive.
zipIgnoreIgnores the file in error.
zipRetryRetries the file extraction.
WEBDEV - Server code This procedure must be a server procedure.
AndroidAndroid Widget Java This parameter is not allowed.
Name of the WLanguage procedure that will be called if an error occurs when extracting files.
CAUTION: This parameter can be used only if <Archive> corresponds to a zipArchive variable.
This procedure has the following format:
PROCEDURE ProcedureName (<Error Code>, <File Name>)
where:
  • <Error Code> is an integer corresponding to the code of the error that occurred when extracting the file.
  • <File Name> is a character string containing the path of the file processed by zipExtractAll.
The procedure can return one of the following constants:
zipCancelCancels the extraction of files from the archive.
zipIgnoreIgnores the file in error.
zipRetryRetries the file extraction.
WEBDEV - Server code This procedure must be a server procedure.
AndroidAndroid Widget Java This parameter is not allowed.
<Management of Progress Bar>: Optional character string (with or without quotes)
Versions 21 and later
Mode for managing the progress bar. This parameter can correspond to:
  • WINDEViPhone/iPadWindows MobileUniversal Windows 10 App the name of a Progress Bar control found in a window. The progress bar will display the progress regarding the extraction of all the files used.
  • the name of a WLanguage procedure. This procedure has the following format:
    <Procedure Name> (<Current File>, <Global Percentage of Progress>,
    <Percentage of File Progress>)

    where:
    • <Current File> corresponds to the name of the file currently processed.
    • <Global Percentage of Progress> corresponds to the percentage of progress regarding the extraction of files from the archive.
    • <Percentage of File Progress> corresponds to the percentage of progress regarding the extraction of the current file from the archive.
If you are using an archive:
  • in TAR or TGZ (TAR.GZ) format, the progress bar is refreshed at the end of the extraction of each file.
  • in CAB and RAR format, the progress bar is refreshed at the end of the extraction of each file.
  • in 7z format, only <Global Percentage of Progress> is specified. <Percentage of File Progress> will have the same value.
WEBDEV - Server code The procedure must be a server procedure.
New in version 21
Mode for managing the progress bar. This parameter can correspond to:
  • WINDEViPhone/iPadWindows MobileUniversal Windows 10 App the name of a Progress Bar control found in a window. The progress bar will display the progress regarding the extraction of all the files used.
  • the name of a WLanguage procedure. This procedure has the following format:
    <Procedure Name> (<Current File>, <Global Percentage of Progress>,
    <Percentage of File Progress>)

    where:
    • <Current File> corresponds to the name of the file currently processed.
    • <Global Percentage of Progress> corresponds to the percentage of progress regarding the extraction of files from the archive.
    • <Percentage of File Progress> corresponds to the percentage of progress regarding the extraction of the current file from the archive.
If you are using an archive:
  • in TAR or TGZ (TAR.GZ) format, the progress bar is refreshed at the end of the extraction of each file.
  • in CAB and RAR format, the progress bar is refreshed at the end of the extraction of each file.
  • in 7z format, only <Global Percentage of Progress> is specified. <Percentage of File Progress> will have the same value.
WEBDEV - Server code The procedure must be a server procedure.
Mode for managing the progress bar. This parameter can correspond to:
  • WINDEViPhone/iPadWindows MobileUniversal Windows 10 App the name of a Progress Bar control found in a window. The progress bar will display the progress regarding the extraction of all the files used.
  • the name of a WLanguage procedure. This procedure has the following format:
    <Procedure Name> (<Current File>, <Global Percentage of Progress>,
    <Percentage of File Progress>)

    where:
    • <Current File> corresponds to the name of the file currently processed.
    • <Global Percentage of Progress> corresponds to the percentage of progress regarding the extraction of files from the archive.
    • <Percentage of File Progress> corresponds to the percentage of progress regarding the extraction of the current file from the archive.
If you are using an archive:
  • in TAR or TGZ (TAR.GZ) format, the progress bar is refreshed at the end of the extraction of each file.
  • in CAB and RAR format, the progress bar is refreshed at the end of the extraction of each file.
  • in 7z format, only <Global Percentage of Progress> is specified. <Percentage of File Progress> will have the same value.
WEBDEV - Server code The procedure must be a server procedure.
Remarks

Error codes

The following error codes are returned:
  • 1: The path passed in parameter does not exist.
  • 2: Access denied: the user has no sufficient rights.
  • 3: The archive is corrupted.
  • 4: The path does not exist in the archive.
  • 6: The files of the sub-archives are not arranged in order (when extracting from a multi-part archive).
The message corresponding to the error code is returned by zipMsgError.
LinuxAndroidAndroid Widget iPhone/iPadWindows MobileUniversal Windows 10 AppJava Reminder: Only the archives in ZIP format are available.
Reminder:
  • LinuxiPhone/iPadUniversal Windows 10 App Only the archives in ZIP, TAR and TGZ (TAR.GZ) format are available.
  • AndroidAndroid Widget Windows MobileJava Only the archives in ZIP format are available.

Extracted file

The extracted files are not deleted from the archive. To delete one file or all the files from the archive, use zipDeleteFile or zipDeleteAll.
WINDEVReports and QueriesWindows MobileUser code (UMC)

Progress bar

In Windows, to view the progress of file extraction and decompression, an event must be branched on CompressGauge (1174).
When this message is received, the _EVE.wParam variable contains the percentage of file already decompressed.
Versions 21 and later
From version 21, <Management of Progress Bar> can also be used to manage the progress of file addition.
New in version 21
From version 21, <Management of Progress Bar> can also be used to manage the progress of file addition.
From version 21, <Management of Progress Bar> can also be used to manage the progress of file addition.
WINDEVWEBDEV - Server codeReports and QueriesAjaxUser code (UMC)

Extraction on diskettes from a multi-part archive

If the files to extract are found on different diskettes, the corresponding diskette is automatically requested. To extract several files from a multi-part archive, we advise you to extract the files according to the order of their subscript in the archive. Therefore, the different diskettes will be requested in ascending order.
Components
WINDEVWEBDEV - Server codeReports and Queries wd230zip.dll
Windows Mobile wp230zip.dll
Java wd230java.jar
Linux wd230zip.so
Android wd230android.jar
Minimum required version
  • Version 9
This page is also available for…
Comments
Example Extract Zip
//Salva Buffer em arquivo Zip em disco
OK = fSaveBuffer(ArquivoZip,bufArquivoZip)

//Descompacta arquivo Zip
ResExtractAll is int
ResOpenArchive is int = zipOpen("Pacote", ArquivoZip)
IF ResOpenArchive = 0 THEN
// Returns the list of files found in the archive
// Display the files in a list
ArquivoTxt = zipListFile("Pacote")
ResExtractAll = zipExtractAll("Pacote")
IF fFileExist(ArquivoTxt) AND ResExtractAll = 0
descompactado = True
ELSE
descompactado = False
END
END
IF ResOpenArchive = 0
OK = zipClose("Pacote")
END
BOLLER
Jun. 07 2017