Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Using 'ZipMaster' in VFP 5.0a
Message
From
20/11/2001 14:43:15
 
 
To
16/11/2001 23:02:48
General information
Forum:
Visual FoxPro
Category:
Third party products
Miscellaneous
Thread ID:
00583062
Message ID:
00584140
Views:
26
>I use 'zipmaster v1.0' (download from http://www.eetasoft.ee/zipmaster.htm) for data backup/restore in my VFP program, my problem is :
>
>1)I fail to get 'TotalSizeToProcess', 'ZipFileSize' property (property does not exist), why?

I am unable to reproduce your problem. I tried the following code and this returns the TotalSizeToProcess property.

x=NEWOBJECT("zip")
nRes = x.zip( 'result.zip', 'c:\autoexec.bat', .f. )
messagebox( str(x.ozip.totalsizetoprocess) )

>2)How can I get the progress bar, or use the 'OnProgress' event? (Work only in VFP 7.0?)

Sample is for VFP 7 only.
In earlier versions you can probably use VFPCOM utility available
at http://www.msdn.microsoft.com/vfoxpro/downloads/vfpcom.exe

>3)How can I programmatically know a zip file is password protected or not?

I don't know about zipmaster.
You can read the zip file directory directly from VFP like the following code.
* ZIPREAD.PRG
*
* Author:  Lee A. Flier       05/05/93
* 
* Written in FoxPro 2.5 for DOS 
*
* ZIPREAD(zipfile) will read a ZIP file and list the names of the files in
* it.  This is useful for checking archived files which you are tracking
* in a database.  Only the file names in the ZIP are returned; no file
* sizes, dates or compression ratios, although these could probably be
* added if someone could figure out which bytes referred to them!
*
* It works similarly to ADIR() in that it creates an array containing
* the file names, and returns the number of files in the ZIP file.
* If the file does not exist, ZIPREAD returns -1.  If the file name
* parameter was not given, it returns -2.  If the file does not appear
* to be a valid ZIP file, -3 is returned.
*
* The array ZIPFILES must be declared in the calling program; it can
* have only 1 element since it is re-declared within the function.
*
* This function appears to work on any file created with PKZIP version
* 2.0 or later; I can't guarantee the results with older ZIP files.

parameters filename
  zipfil=fopen(filename)
  if zipfil <= 0     && file not found or parameter not given
     return zipfil   && so return the error message
  endif
  iszip=fread(zipfil,3)
  if iszip <> 'PK'+chr(3)   && first characters in a valid ZIP file
    return -3
  endif

  * The 14th byte from the end of the file contains the number of
  * files.  Create an array sized appropriately.

  =fseek(zipfil,-14,2)
  znum=asc(fread(zipfil,1))
  if znum=0
    =fclose(zipfil)
    return -3
  endif
  
  =fseek(zipfil,-22,2) 
  iszip=fread(zipfil,2)   && check for invalid file
  if iszip <> 'PK'
    =fclose(zipfil)
    return -3
  endif
  
  declare zipfiles[znum]    
  =fseek(zipfil,-23,2)    && move pointer to end of last filename

  * Read backwards through the ZIP file, storing each file name
  * to an array element

  for x=znum to 1 step -1   
    store '' to curr_file   && the current file name being read
    z=fread(zipfil,1)
    do while z <> chr(0)
      curr_file=z+curr_file
      =fseek(zipfil,-2,1)
      z=fread(zipfil,1)
    enddo
    zipfiles[x] = curr_file
    =fseek(zipfil,-46,1)
    iszip=fread(zipfil,2)   && check for invalid file
    if iszip <> 'PK'
      =fclose(zipfil)
       return -3
    endif
    =fseek(zipfil,-3,1)
  endfor
  =fclose(zipfil)
  
return znum  
    
Andrus
Previous
Reply
Map
View

Click here to load this message in the networking platform