PC SOFT

WINDEVWEBDEV AND WINDEV MOBILE
ONLINE HELP

Home | Sign in | English UK
  • Displaying the files currently extracted
  • Displaying the files currently extracted
zipCurrentFile (Example)
Displaying the files currently extracted
WINDEVWEBDEV - Server codeReports and QueriesAjaxUser code (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
ErrorCodeCreation is int
ErrorCodeAddition is int
ErrorCodeExtract is int
EventNum is int
 
// Create an archive
ErrorCodeCreation = zipCreate(ArchiveName, "C:\Directory\Archives\ArchivePdf.zip")
 
IF ErrorCodeCreation = 0 THEN
// Select the directory
DirectoryName = fSelectDir("", "", "Directory to add")
// Add all the files found in the selected directory
// and in its subdirectories into the archive
ErrorCodeAddition = zipAddDirectory(ArchiveName, DirectoryName, True, zipDirectory)
IF ErrorCodeAddition = 0 THEN
// Call the event
EventNum = Event("Dis_Compress_ProgressBar", WinInput(), compressProgressBar)
// Extract and decompress the files into the current directory
ErrorCodeExtract = zipExtractAll(ArchiveName, zipDirectory)
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
// End of event
EndEvent(EventNum)
ELSE
 // Display an error message if the files have not been added
 Error(zipMsgError(ErrorCodeAddition))
END
ELSE
// Display an error message if the archive was not created
Error(zipMsgError(ErrorCodeCreation))
END
// Procedure local to the window. This procedure is used to manage the progress bar.
PROCEDURE Dis_Compress_ProgressBar(wMessage, wParam, lParam)
IF wParam < 100 THEN
// Update the progress bar and display the file currently extracted
ProgressBar(wParam, 100, zipCurrentFile(ArchiveName))
// Refresh the window
Multitask(-1)
ELSE
// The compression is over
ProgressBar()
END
Displaying the files currently extracted
Windows Mobile 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
ErrorCodeCreation is int
ErrorCodeAddition is int
ErrorCodeExtract is int
EventNum is int
 
// Create an archive
ErrorCodeCreation = zipCreate(ArchiveName, "\Directory\Archives\ArchivePdf.zip")
 
IF ErrorCodeCreation = 0 THEN
// Select the directory
DirectoryName = fSelectDir("", "", "Directory to add")
// Add all the files found in the selected directory
// and in its subdirectories into the archive
ErrorCodeAddition = zipAddDirectory(ArchiveName, DirectoryName, True, zipDirectory)
IF ErrorCodeAddition = 0 THEN
// Call the event
EventNum = Event("Dis_Compress_ProgressBar", WinInput(), compressProgressBar)
// Extract and decompress the files into the current directory
ErrorCodeExtract = zipExtractAll(ArchiveName, zipDirectory)
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
// End of event
EndEvent(EventNum)
ELSE
 // Display an error message if the files have not been added
 Error(zipMsgError(ErrorCodeAddition))
END
ELSE
// Display an error message if the archive was not created
Error(zipMsgError(ErrorCodeCreation))
END
// Procedure local to the window. This procedure is used to manage the progress bar.
PROCEDURE Dis_Compress_ProgressBar(wMessage, wParam, lParam)
IF wParam<100 THEN
// Update the progress bar and display the file currently extracted
ProgressBar(wParam, 100, zipCurrentFile(ArchiveName))
// Refresh the window
Multitask(-1)
ELSE
// The compression is over
ProgressBar()
END
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment