|

the software that grows
with you
| |
|
V32ZipFiles()
|
| Compresses the given files with or
without password in a .ZIP file format. It can be unzipped with
Pkunzip.exe as well besides V32UnZipFile() function. |
|
Syntax
|
| V32ZipFiles( <cZipFile>,
<aFilesToZip>, <cPassword>, <lProgressBar>,
<lWantInfo>, <aProgInfo> ) |
|
Arguments
|
| cZipFile |
A qualified file name with drive, path and extension
information to store the archieve. If <cZipFile> already
exists, it will be overwritten. |
| aFilesToZip |
A one dimentional array containg the name of files to
zip. File names must be qualified file names with drive, path
and extension information. If drive letter is omitted, current drive
will be the default. But ommitting path info may cause this function
to fail. All WinApi calls, dealing with the disk files, require
fully qualified file names to function properly. |
| cPassword |
Optioanal password string of any length. Default is
null string. If <cPassword> is used to update the archive, the
same password string will be required to use V32UnZipFile()
function. |
| lProgressBar |
Optional parameter to switch on the progress bar.
Default is FALSE. If switched on, while archive is being updated, a
progress bar will be displayed and file name currently being
processed will appear in the title bar of the progress bar
window. |
| lWantInfo |
Optional parameter to instruct whether this function
should return the information gathered from archive just updated as
an array ( see below ). If <lWantInfo> is TRUE, control will
not be returned to the application until archieve is completed. If
<lWantInfo> is FALSE, control returns immediately after
calling this function and archive will be processed independently in
the background. |
| aProgInfo |
An optional array with following structure which will
be used to configure the Progress Bar. This structure will only be
considered if <lProgressBar> is set to TRUE. The structure is:
| cTitle |
Character string to be displayed in
the title bar of progress window in conjuction with the file
name being zipped. Default is a null string. |
| nBkColor |
RGB color value comprising the
background color of bar area. Default is the value returned by
GetSysColor( COLOR_BTNFACE ). |
| nBarColor |
RGB color value comprising the bar
color. Default is the value returned by GetSysColor(
COLOR_HIGHLITE ). |
| nStyle |
Numeric to control the style of the
Progress Bar one of the two possible values, 1 or 2. Default is
1 means bar will move as smooth. The other is boxed progress. |
| lShowPercent |
Logical to switch on or off whether
percent be displayed or not at the middle of progress area.
Default is TRUE. |
| lBorder |
Logical to specify whether a border
be displayed around the progress area or not. Default is
FALSE. |
|
|
|
Returns
|
An array of three elements if
<lWantInfo> is TRUE with the following structure:
{ Total_Files_Archieved, Total_Uncompressed_Bytes,
Total_Compressed_Bytes },
otherwise it will return { 0, 0, 0 }. |
|
Description
|
| V32ZipFiles() is a utility to archive
application's data from a developers point of view. User can be offered
inhouse solution to backup his critical data through a menu option. It
eliminates the neccessity of any external utility to do so. Although I am
using it extensively and withour errors till date, but I would like to
hear if there is any anomaly from the documentation. Moreover any
suggestions will be welcome to enhance this utility. |
|
Usage
|
local cZipFile := 'c:\application\backup\Backup1.zip'
local cPassword := ''
local lProgress := .t.
local lWantInfo := .t.
local aFiles_ := {}
local aInfo_ := {}
aadd( aFiles_, 'c:\config.sys' )
aadd( aFiles_, 'c:\autoexec.bat' )
// More files
aInfo_:= V32ZipFiles( cZipFile, aFiles_, cPassword, lProgress, lWantInfo )
? aInfo_[ 1 ] // Total number of compressed files
? aInfo_[ 2 ] // Total uncompressed bytes in archive
? aInfo_[ 3 ] // Total compressed bytes |
|
Tips
|
| Maintain a log book of backups with
returned information from this function and compare it somehow whenever
restoring the backups becomes neccessity. To get detailed information
about the archive, use V32ZipInfo() function. |
|