PC SOFT

WINDEVWEBDEV AND WINDEV MOBILE
ONLINE HELP

Home | Sign in | English UK
  • Compressing a file (WINDEV)
  • Compressing a file (WEBDEV)
fCompress (Example)
Compressing a file (WINDEV)
WINDEVReports and QueriesUser code (UMC) The following code is used to compress a file. The file to compress and the compressed file are selected by fSelect. A progress bar is used to indicate the percentage of compression. 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
Compressing a file (WEBDEV)
WEBDEV - Server codeAjax The following code is used to compress a file.
// -- 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 = "C:\MyDir\Account.doc"

// Select the compressed file
CompressedFile = "C:\MyDir\Account.do_"

// Compress the file
ResCompression = fCompress(FileToCompress, CompressedFile)

// Display an error message if the compression failed
IF ResCompression <> 0 THEN
Error(ErrorInfo(errMessage))
ELSE
Info("The compression was performed")
END
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment