ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Standard functions / External file functions
fCompress (Example)
WINDEVUser code (UMC) Compressing a file (WINDEV)
The following code is used to compress a file. The file to compress and the compressed file are selected by fSelect. A progress indicates the compression percentage. This progress bar will be displayed in the status bar.
// -- Click code on BTN_CompressFile
 
// Initialization code
EventNum is int
FileToCompress is string
CompressedFile is string
ResCompression is int
 
// Select the file to compress
FileToCompress = fSelect("", "", "Select the file to compress", ...
"All files (*.*)" + TAB + "*.*", "", fselOpen + fselExist)
 
// Select the compressed file
CompressedFile = fSelect("", "", "Select the compressed file", ...
"All files (*.*)" + TAB + "*.*", "", fselCreate)
 
// Call the event to display the progress bar
EventNum = Event("Dis_Compress_ProgressBar", WinInput(), compressProgressBar)
 
// Compress the file
ResCompression = fCompress(FileToCompress, CompressedFile)
 
// End of event
EndEvent(EventNum)
 
// Display an error message if the compression failed
IF ResCompression <> 0 THEN
Error(ErrorInfo(errMessage))
ELSE
  Info("The compression was performed")
END
// Local procedure Dis_Compress_ProgressBar
PROCEDURE Dis_Compress_ProgressBar(wMessage, wParam, lParam)
IF wParam < 100 THEN
ProgressBar(wParam, 100)
  // 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

Last update: 08/25/2022

Send a report | Local help