PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN
This content has been translated automatically. Click here to view the French version.
  • Error codes
  • Extracted file
  • Extraction and password
  • Subscript of files in the archive
  • Stored path
  • Extraction from a multi-part archive on diskettes
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 a file from an archive and automatically decompresses it to a physical location or in memory.
Versions 15 and later
Android This function is now available for Android applications.
New in version 15
Android This function is now available for Android applications.
Android This function is now available for Android applications.
Versions 17 and later
iPhone/iPad This function is now available for iPhone/iPad applications.
New in version 17
iPhone/iPad This function is now available for iPhone/iPad applications.
iPhone/iPad This function is now available for 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 codeWindowsLinuxUniversal Windows 10 AppiPhone/iPad 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 codeWindowsLinuxUniversal Windows 10 AppiPhone/iPad 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 codeWindowsLinuxUniversal Windows 10 AppiPhone/iPad This function now supports the TAR and TGZ (TAR.GZ) formats.
WINDEVWEBDEV - Server codeReports and QueriesWindows MobileUser code (UMC)Ajax
Archive is zipArchive
// Ouverture d'une archive
ResOuvreArchive = zipOpen(Archive, "C:\Archives\Archive.zip")
// En Windows Mobile:
// ResOuvreArchive = zipOuvre(Archive, "\Archives\Archive.zip")
 
IF ResOuvreArchive = 0 THEN
...
 // Extraction d'un fichier à son emplacement d'origine
 ResExtraitFichier = zipExtractFile(Archive, "Fichier.txt", zipDrive)
...
END
Syntax

Extracting a file identified by its subscript Hide the details

<Result> = zipExtractFile(<Archive> , <File subscript> [, <File destination> [, <Progress>]])
<Result>: Integer or buffer
  • 0 if the file was extracted,
  • An error code (value greater than 0) otherwise. For more details on these error codes, see the Remarks.
When extracting "in memory", corresponds to the buffer containing the extracted file.
<Archive>: Character string (with quotes) or zipArchive variable
Name of archive to use.
This name can correspond to:
<File subscript>: Integer
Subscript of file to extract from the archive. This subscript can be known through the zipFindFile function.
<File destination>: Optional character string or constant
Destination path of extracted file:
  • Optional character string: The file is extracted into the specified path to which is added the stored tree structure of file (the drive is not stored). The specified path is created if it does not exist.
    Universal Windows 10 App The destination path of the extracted file must correspond to the working directory of the application (returned by fDataDir) or one of its subdirectories.
  • Optional constant:
    zipNoneExtraction into the current directory without restoring the tree structure of file (if it was stored).
    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.
    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.
    zipInMemoryExtracts the file in memory. The file content is directly returned by the function. It can be assigned to a Buffer variable for example.
    This feature is available for ZIP and WDZ archives only.
    zipDirectory
    (Default value)
    Extraction into the current directory while restoring the tree structure of file (if it was stored).

    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.
<Progress>: Control name or procedure name
Versions 21 and later
Progress bar management mode. This parameter can correspond to:
  • WINDEVUniversal Windows 10 AppWindows MobileiPhone/iPad the name of a Progress Bar control found in a window. The progress bar will display the progress of file extraction.
  • the name of a WLanguage procedure. This procedure has the following format:
    <Nom de la procédure> (<Fichier en cours>, <Pourcentage d'avancement>)

    where:
    • <Current file> corresponds to the name of the file currently processed.
    • <Progress percentage> corresponds to the progress percentage of the file being extracted from the archive.
Caution: The progress bar is refreshed at the end of file extraction for the following types of archives:
  • TAR or TGZ (TAR.GZ),
  • RAR,
  • CAB.
New in version 21
Progress bar management mode. This parameter can correspond to:
  • WINDEVUniversal Windows 10 AppWindows MobileiPhone/iPad the name of a Progress Bar control found in a window. The progress bar will display the progress of file extraction.
  • the name of a WLanguage procedure. This procedure has the following format:
    <Nom de la procédure> (<Fichier en cours>, <Pourcentage d'avancement>)

    where:
    • <Current file> corresponds to the name of the file currently processed.
    • <Progress percentage> corresponds to the progress percentage of the file being extracted from the archive.
Caution: The progress bar is refreshed at the end of file extraction for the following types of archives:
  • TAR or TGZ (TAR.GZ),
  • RAR,
  • CAB.
Progress bar management mode. This parameter can correspond to:
  • WINDEVUniversal Windows 10 AppWindows MobileiPhone/iPad the name of a Progress Bar control found in a window. The progress bar will display the progress of file extraction.
  • the name of a WLanguage procedure. This procedure has the following format:
    <Nom de la procédure> (<Fichier en cours>, <Pourcentage d'avancement>)

    where:
    • <Current file> corresponds to the name of the file currently processed.
    • <Progress percentage> corresponds to the progress percentage of the file being extracted from the archive.
Caution: The progress bar is refreshed at the end of file extraction for the following types of archives:
  • TAR or TGZ (TAR.GZ),
  • RAR,
  • CAB.

Extracting a file identified by its path Hide the details

<Result> = zipExtractFile(<Archive> , <File path> [, <File destination> [, <Progress>]])
<Result>: Integer or buffer
  • 0 if the file was extracted,
  • An error code (value greater than 0) otherwise. For more details on these error codes, see the Remarks.
When extracting "in memory", corresponds to the buffer containing the extracted file.
<Archive>: Character string (with quotes) or zipArchive variable
Name of archive to use.
This name can correspond to:
<File path>: Character string (with quotes)
Stored path of file to extract from the archive. Performs an exact-match search on the path of file in the archive.
<File destination>: Optional character string or constant
Destination path of extracted file:
  • Optional character string: The file is extracted into the specified path to which is added the stored tree structure of file (the drive is not stored). The specified path is created if it does not exist.
    Universal Windows 10 App The destination path of the extracted file must correspond to the working directory of the application (returned by fDataDir) or one of its subdirectories.
  • Optional constant:
    zipNoneExtraction into the current directory without restoring the tree structure of file (if it was stored).
    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.
    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.
    zipInMemoryExtracts the file in memory. The file content is directly returned by the function. It can be assigned to a Buffer variable for example.
    This feature is available for ZIP and WDZ archives only.
    zipDirectory
    (Default value)
    Extraction into the current directory while restoring the tree structure of file (if it was stored).

    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.
<Progress>: Control name or procedure name
Versions 21 and later
Progress bar management mode. This parameter can correspond to:
  • WINDEVUniversal Windows 10 AppWindows MobileiPhone/iPad the name of a Progress Bar control found in a window. The progress bar will display the progress of file extraction.
  • the name of a WLanguage procedure. This procedure has the following format:
    <Nom de la procédure> (<Fichier en cours>, <Pourcentage d'avancement>)

    where:
    • <Current file> corresponds to the name of the file currently processed.
    • <Progress percentage> corresponds to the progress percentage of the file being extracted from the archive.
Caution: The progress bar is refreshed at the end of file extraction for the following types of archives:
  • TAR or TGZ (TAR.GZ),
  • RAR,
  • CAB.
New in version 21
Progress bar management mode. This parameter can correspond to:
  • WINDEVUniversal Windows 10 AppWindows MobileiPhone/iPad the name of a Progress Bar control found in a window. The progress bar will display the progress of file extraction.
  • the name of a WLanguage procedure. This procedure has the following format:
    <Nom de la procédure> (<Fichier en cours>, <Pourcentage d'avancement>)

    where:
    • <Current file> corresponds to the name of the file currently processed.
    • <Progress percentage> corresponds to the progress percentage of the file being extracted from the archive.
Caution: The progress bar is refreshed at the end of file extraction for the following types of archives:
  • TAR or TGZ (TAR.GZ),
  • RAR,
  • CAB.
Progress bar management mode. This parameter can correspond to:
  • WINDEVUniversal Windows 10 AppWindows MobileiPhone/iPad the name of a Progress Bar control found in a window. The progress bar will display the progress of file extraction.
  • the name of a WLanguage procedure. This procedure has the following format:
    <Nom de la procédure> (<Fichier en cours>, <Pourcentage d'avancement>)

    where:
    • <Current file> corresponds to the name of the file currently processed.
    • <Progress percentage> corresponds to the progress percentage of the file being extracted from the archive.
Caution: The progress bar is refreshed at the end of file extraction for the following types of archives:
  • TAR or TGZ (TAR.GZ),
  • RAR,
  • CAB.
Remarks

Error codes

The following error codes are returned:
  • 1: The path passed as 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).
  • 21: The specified password is not correct.
The message corresponding to the error code is returned by zipMsgError. Reminder:
  • LinuxUniversal Windows 10 AppiPhone/iPad Only ZIP, TAR and TGZ (TAR.GZ) archives are available.
  • Windows MobileAndroidAndroid Widget Java Only ZIP archives are available.

Extracted file

The extracted file is not deleted from the archive. To delete one file or all the files from the archive, use zipDeleteFile or zipDeleteAll.
WINDEVWEBDEV - Server codeReports and QueriesUniversal Windows 10 AppWindows MobileiPhone/iPadUser code (UMC)Ajax

Extraction and password

If the file is not encrypted and if zipPassword was used:
  • Archive in WDZ format: The file is still extracted.
  • Archive in ZIP format: An error occurs.

Subscript of files in the archive

When a file is added into an archive, a subscript is automatically assigned to the file. This subscript corresponds to the order in which the files are included in the archive. To select a file in the archive, you can use:
  • or the subscript of the element (the subscript of an element can be known thanks to the zipFindFile function).
  • the stored path of element.

Stored path

The table below presents the paths stored in the archive according to:
  • the access path to the file,
  • the stored path section.
The current directory is: "C:\Temp".
zipAddFileFile locationzipNonezipDirectoryzipDrive
zipAddFile("Archi",...
"File.txt")
C:\Temp\File.txtFile.txtFile.txtFile.txt
zipAddFile("Archi",...
"Data\File.txt")
C:\Temp\Data\File.txtFile.txtData\File.txtData\File.txt
zipAddFile("Archi",...
"D:\Data\File.txt")
D:\Data\File.txtFile.txtData\File.txtD:\Data\File.txt
Remark: If the zipDrive constant is used:
  • the WDZ format stores the full path of the file (including the drive letter).
  • the ZIP format does not store the drive letter.
  • the 7z format stores the directories only.
AndroidAndroid Widget Java The zipDrive constant is equivalent to the zipDirectory constant.
Universal Windows 10 App The directory and the disk are not stored in the archive path. Only the file name and extension are stored.
Windows Mobile The table below presents the paths stored in the archive according to:
  • the access path to the file,
  • the stored path section.
zipAddFileFile locationzipNonezipDirectory
zipAddFile("Archi",...
"\File.txt")
\File.txtFile.txtFile.txt
zipAddFile("Archi",...
"\Temp\File.txt")
\Temp\File.txtFile.txtTemp\File.txt
WINDEVWEBDEV - Server codeReports and QueriesUser code (UMC)Ajax

Extraction from a multi-part archive on diskettes

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.
Business / UI classification: Business Logic
Component: wd260zip.dll
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment