dbZIP - Dave's BigZIP Templates
List of prototyped functions ...

Home

Functions | Order !

The following is from the help file supplied with the bigspeed zip dll.

This is the visual basic form - all the clarion prototypes are included in the Global Map when the dbZIP Global Template is applied!

 

  BigSpeed Zip DLL


Description of API functions - Visual Basic style



 


'-----BigSpeed zip dll API functions
'     Note: For arguments, True = 1 , False = 0.

'.....This function opens zip file and creates a list of items, corresponding to
'     contents of zip file. Must be called before any other function to get access
'     to zip file. ZipFileName is the path and full name of zip file,
'     for example: 'C:\TEST.ZIP'. Returns zero on success.
Declare Function zOpenZipFile Lib "bszip.dll" (ByVal ZipName As String) As Long
ZipName  is the full path and name of the zip file.

'.....Closes zip file, opened with zOpenZipFile. Returns zero on success.
Declare Function zCloseZipFile Lib "bszip.dll" () As Long

'.....Returns the total number of compressed files within zip file, i.e. the number
'     of items in the list. First item has index = 0, last item has '
'     Index = zGetTotalFiles - 1
Declare Function zGetTotalFiles Lib "bszip.dll" () As Long


'.....Returns the sum of uncompressed file size of all files within zip file.
Declare Function zGetTotalBytes Lib "bszip.dll" () As Long

'.....Returns the number of currently selected files.
Declare Function zGetSelectedFiles Lib "bszip.dll" () As Long

'.....Returns the sum of uncompressed file size of selected files within zip file.
Declare Function zGetSelectedBytes Lib "bszip.dll" () As Long

'.....If some error occurs in the DLL, this function will return a pointer to a string
'     that describes the error.
'     MUST be wrapped with StringFromPointer to obtain the VB String
Declare Function zGetLastErrorAsText Lib "bszip.dll" () As Long

'.....After extracting operation, this function will return the number of skipped
'     files - usually zero.
Declare Function zGetSkippedFiles Lib "bszip.dll" () As Long

'.....This function returns the number of currently processed files and bytes.
'     This is necessary to calculate position of progress indicator.
'     Returns 1 on success.
Declare Function zGetRunTimeInfo Lib "bszip.dll" (ByRef ProcessedFiles As Long, ByRef ProcessedBytes As Long) As Byte

'.....To cancel extract operation, call this function.
Declare Function zCancelOperation Lib "bszip.dll" () As Byte

'.....Extracts only one of the file in zip file. This is useful for viewing/launching files.
Declare Function zExtractOne Lib "bszip.dll" (ByVal ItemNo As Long, _
  ByVal ExtractDirectory As String, ByVal Password As String, _
  ByVal OverwriteExisting As Byte, ByVal SkipOlder As Byte, _
  ByVal UseFolders As Byte, ByVal TestOnly As Byte, _
  ByVal RTInfoFunc As Long) As Long

'     Parameters are:
'    ItemNo-  Item number of the file in the list.
'          0<= ItemNo <= zGetTotalFiles-1
'     ExtractDirectory- Directory where to extract files. If empty, current directory is used.
'     Password- password to be used, if file is encrypted.
'     OverwriteExisting- if 1, any existing file will be overwritten, otherwise will be skipped.
'     SkipOlder- if 1, files with newer date/time on the disk will not be overwritten.
'     UseFolders- if 1, the relative path information stored in zip file will be used to determine
'          location of the extracting file.
'     TestOnly- if 1, files are only tested, not saved to disk.
'     RTInfoFunc- pointer to the application function, which will be called
'          periodically from library to show runtime information,
'          for example some kind of progress bar. Within this function, application can
'          call zGetRunTimeInfo or zCancelOperation. If nil, no runtime information will
'          be available.
'          In VB5+, this may be called by using AddressOf in the call, in VB4 set to nil.
'
'     Return value is zero on success, otherwise application can call zGetLastErrorAsText to get
'     type of error.

'.....Extracts only files in the list, previously selected by zSelectFile.
'     Parameters are the same as in zExtractOne. Returns zero on success.
Declare Function zExtractSelected Lib "bszip.dll" ( _
   ByVal ExtractDirectory As String, ByVal Password As String, _
  ByVal OverwriteExisting As Byte, ByVal SkipOlder As Byte, ByVal UseFolders As Byte, _
  ByVal TestOnly As Byte, ByVal RTInfoFunc As Long) As Long


'.....Extracts all files. Parameters are the same as in zExtractOne.
'     Returns zero on success.
Declare Function zExtractAll Lib "bszip.dll" ( _
   ByVal ExtractDirectory As String, ByVal Password As String, _
   ByVal OverwriteExisting As Byte, ByVal SkipOlder As Byte, _
   ByVal UseFolders As Byte, _
   ByVal TestOnly As Byte, _
   ByVal RTInfoFunc As Long) As Long



'.....Returns a pointer to the name of the file in the list with index i.
'     MUST be wrapped with StringFromPointer to obtain the VB String
Declare Function zGetFileName Lib "bszip.dll" (ByVal i As Long) As Long


'.....Returns a pointer to the extension of the file in the list with index i.
'     MUST be wrapped with StringFromPointer to obtain the VB String
Declare Function zGetFileExt Lib "bszip.dll" (ByVal i As Long) As Long

'.....Returns a pointer to the stored path of the file in the list with index i.
'     MUST be wrapped with StringFromPointer to obtain the VB String
Declare Function zGetFilePath Lib "bszip.dll" (ByVal i As Long) As Long

'.....Returns the MSDOS date of the file in the list with index i.
Declare Function zGetFileDate Lib "bszip.dll" (ByVal i As Long) As Long

'.....Returns the MSDOS time of the file in the list with index i.
Declare Function zGetFileTime Lib "bszip.dll" (ByVal i As Long) As Long

'.....Returns the uncompressed size of the file in the list with index i.
Declare Function zGetFileSize Lib "bszip.dll" (ByVal i As Long) As Long

'.....Returns the compressed size of the file in the list with index i.
Declare Function zGetCompressedFileSize Lib "bszip.dll" (ByVal i As Long) As Long

'.....Returns 1, if file in the list with index i is encrypted.
Declare Function zFileIsEncrypted Lib "bszip.dll" (ByVal i As Long) As Byte

'.....Returns a pointer to the result of the last operation on the file in the list with index i.
'     Usually 'Ok.'
'     MUST be wrapped with StringFromPointer to obtain the VB String
Declare Function zGetLastOperResult Lib "bszip.dll" (ByVal i As Long) As Long

'.....Returns 1, if file in the list with index i is selected.
Declare Function zFileIsSelected Lib "bszip.dll" (ByVal i As Long) As Byte

'.....Select/Unselect file in the list with index i. If how is 1, the file will be selected,
'     otherwise will be unselected.
Declare Function zSelectFile Lib "bszip.dll" (ByVal i As Long, ByVal how As Byte) As Byte

'.....To unselect all files in the list call this function
Declare Function zUnselectAll Lib "bszip.dll" () As Byte

'.....Selects files in the zip archive using wildcard pattern
Declare Function zSelectByWildcards Lib "bszip.dll" (ByVal FileMask As String, _
ByVal IncludeSubfolders As Byte) As Long

'     Parameters are:
'     FileMask- Wildcard pattern to be used, for example: "C:\TEST\*.TXT; *.DOC"
'     IncludeSubfolders- If True, the subfolders will be searched too for matched files.


'.....Creates new empty zip file witn name ZipFileName, for example: "C:\temp\test.zip".
'     Returns zero on success.
Declare Function zCreateNewZip Lib "bszip.dll" (ByVal zipname As String) As Long


'.....Call this function after zCreateNewZip or zOpenZipFile for every file, which must be included
'     in the Zip file. The function checks if the file already exists in the archive, date and time
'     of the file depending of the UpdateMode, and if the conditions are true, adds the file to the
'     list of "to be compressed files".
Declare Function zOrderFile Lib "bszip.dll" (ByVal FileName As String, ByVal StoredName As String, _
   ByVal UpdateMode As Long) As Long

'     Parameters are:
'     FileName- the full path and name of the file, for example: "C:\TEMP\TEST.TXT"
'     StoredName- this is the path and the name, under which the file must be stored in zip file,
'          for example: "TEMP\TEST.TXT".
'     UpdateMode- points if the file must be added if it is already exists in the archive. There
'          are 3 possible values:
'          0 - "Add (and Replace) file", if file does not exist in the archive, it will be added, if exists, it will be replaced.
'          1 - "Freshen file", file will be compressed only if it already exists in the archive and is newer.
'          2 - "Update file", file will be compressed if does not exists in the archive or if it exists, but is newer.
'     The return value is zero if the file is succesfuly added to "Add List".


'.....Selects files to be compressed into zip archive using wildcard pattern
Declare Function zOrderByWildcards Lib "bszip.dll" (ByVal FileMask As String, _
ByVal BasePath As String, _
ByVal IncludeSubfolders As Byte, _
ByVal CheckArchiveAttribute As Byte, _
ByVal UpdateMode As Long) As Long

'     Parameters are:
'  FileMask - The wildcard pattern to be used, for example: "C:\TEST\*.TXT; *.DOC"
'  BasePath - This is the shared part of the path to be excluded from all selected files, when they will be stored in the archive, for example: "C:\TEST\".
'  IncludeSubfolders - If True, the subfolders will be searched too for matched files.
'  CheckArchiveAttribute - If True, only those of the files will be added, which have set "Archive" attribute.
'  UpdateMode - Points if the file must be added if it already exists in the archive. There are 3 possible values:
'   0 - "Add (and Replace) file", if the file does not exist in the archive, it will be added, if exists, it will be replaced.
'   1 - "Freshen file", the file will be compressed only if it already exists in the archive and is newer.
'   2 - "Update file", the file will be compressed if it does not exist in the archive or if it exists, but is newer.
'Return: Zero on success, otherwise an error code.


'.....Call this function to actually compress the files, previously requested with zOrderFile/zOrderByWildcards.
Declare Function zCompressFiles Lib "bszip.dll" _
      (ByVal TempDir As String, _
       ByVal Password As String, _
       ByVal CompressionMethod As Long, _
       ByVal ResetArchiveAttribute As Byte, _
       ByVal SpanSize As Long, _
       ByVal Comment As String, _
       ByVal RTInfoFunc As Long) As Long

'     Parameters are:
'     TempDir- the temporary directory to be used
'     Password- if is not empty, the files will be encrypted with this password.
'     CompressionMethod- there are 4 possible values:
'          0 : Stored, no compression
'          1:     Fast compression
'          2:     Normal compression
'          3:     Max compression
'     ResetArchiveAttribute - if it is 1, the Archive attribute of the file will be reset after the
'          compressing of the file.
'

'     SpanSize - There are 3 cases here:
'          < 0 : Disabled - spanning is not allowed.
'          = 0 : Automatic - automatically prompt for another diskette when the current one is full. Applicable only for removable drives.
'          > 0 : Custom - multi-volume zip archive will be created and this value will be the maximum size of each volume. Applicable only for non-removable drives.

'     Comment - if is not empty, will be stored as a comment in the zip file.

'     RTInfoFunc- pointer to the application function, which will be called periodically from
'          library to show runtime information, for example some kind of progress bar.
'          Within this function, application can call zGetRunTimeInfo or zCancelOperation.
'          If nil, no runtime information will be available.
'          In VB5+, this may be called by using AddressOf in the call, in VB4 set to nil.
'
'     Return value is zero on success, otherwise application can call zGetLastErrorAsText
'     to get type of error.
'
'     Do not forget to close the zip file with zCloseZipFile.




'.....Removes the selected files from the zip archive. Returns zero on success, otherwise an error code.
Declare Function zDeleteFiles Lib "bszip.dll" () As Long

'.....Returns the number of files requested for compression with functions zOrderFile/zOrderByWildcards.
Declare Function zGetOrderedFiles Lib "bszip.dll" () As Long

'.....Returns the total size of files requested for compression with functions zOrderFile/zOrderByWildcards.
Declare Function zGetOrderedBytes Lib "bszip.dll" () As Long

'.....Returns a pointer to the stored comment in the zip file
'     MUST be wrapped with StringFromPointer to obtain the VB String
Declare Function zGetComment Lib "bszip.dll" () As Long

'.....To check if the opened zip file is spanned on many disks/volumes, call this function.
Declare Function zIsSpanned Lib "bszip.dll" () As Byte






Tasks





To create a zip file and add (compress) file into it

step 1. create the zip file
        x = zCreateNewZip('ZipFileName.zip')
step 2. do one time for every file to be added to the zip
        y = zOrderFile('FullPath_and_FileName.txt', 'ShortFileName', Update_mode)
step 3. write the zip file to disk
        x = zCompressFiles('TempDir', 'Password', compress_type, Reset_Archive_Bit, SpanSize, Comment, Progress_Function)
step 4. close the file
        x = zCloseZipFile()

if x <>0 in each of above there was an error
 
 
 

To extract (decompress) all files from a zip file

step 1. open the zip file
        x = zOpenZipFile('ZipFileName.zip')
step 2. extract the files to disk
        x = zExtractAll('Extract_Directory', 'Password', Overwrite_Existing, Use_Folders, Test_Only, Progress_Function)
step 3. close the file
        x = zCloseZipFile()

if x <>0 in each of above there was an error
 
 
 
 

                                 List of error codes

  ERR_CMPR_DATA         = 1;         The structure of ZIP file is damaged
  ERR_OLD_METH          = 2;         Old compression method is used
  ERR_READ_FILE         = 3;         Cannot read from file
  ERR_OPEN_FILE         = 4;         Cannot open file
  ERR_WRITE_FILE        = 5;         Cannot write to file
  ERR_CREATE_FILE       = 6;         Cannot create new file
  ERR_RUN_TIME          = 7;         Error in runtime info function
  ERR_USER_BREAK        = 8;         User break
  ERR_FILE_EXISTS       = 9;         File already exists
  ERR_DELETE_OLD        = 10;        Cannot delete the old zip file
  ERR_RENAME_TEMP       = 11;        Cannot rename the temporary file
  ERR_CREATE_TEMP       = 12;        Cannot create the temporary file
  ERR_DIR_DOESNOTEXIST  = 13;        Target directory does not exist
  ERR_OPEN_TEMP         = 14;        Cannot open the temporary zip file
  ERR_FIRST_VOLUME      = 15;        This is the first volume of spanned zip set, the last one is needed
  ERR_CANNOT_FIND_VOLUME= 16;        Cannot find a volume of the spanned zip file



(c) BigSpeedSoft,1998-2001

The Global template is supplied with the shareware version of the bigspeed zip dll.  This has no restrictions but it displays a message suggesting you register it!