|

the software that grows
with you
| |
|
V32UnZipFile()
|
| 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
|
| V32UnZipFile( <cFileToUnzip>,
<cPathToUnZip>, <cPassword>, <lProgressBar>,
<lWantInfo>, <aProgInfo> ) |
|
Arguments
|
| cFileToUnzip |
A qualified file name with drive, path and extension
information to restore the archieve. If <cFileToUnzip> does
not exist or it does not contain any file(s) for the purpose, the
operation will fail and will return with {0,0,0} array. |
| cPathToUnZip |
A fully qualified path name with drive specification
where archive is to be restored. It must not contain trailing '\'
backslash. If any files from the archive will already exist on the
destination path, those will be overwritten. |
| cPassword |
Optioanal password string of any length. Default is
null string. If <cPassword> is used to restore the archive, the
same password string would have been used with V32ZipFiles()
function. |
| lProgressBar |
Optional parameter to switch on the progress bar.
Default is FALSE. If switched on, while archive is being restore, 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 restored as
an array ( see below ). If <lWantInfo> is TRUE, control will
not be returned to the application until action 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
|
| V32UnZipFile() is a utility to restore application's data archived
earlier from a developers point of view. User can be offered
inhouse solution to backup his critical data through a menu option and
also the feature to restore it. 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 cFileToUnzip := 'c:\application\backup\Backup1.zip'
local cPathToUnzip := 'c:\application\data'
local cPassword := ''
local lProgress := .t.
local lWantInfo := .t.
local aInfo_ := {}
aInfo_:= V32ZipFiles( cFileToUnzip, cPathToUnzip, 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. |
|