home *** CD-ROM | disk | FTP | other *** search
/ Hot Shareware 32 / hot34.iso / ficheros / 9ZIP / TSUZDLL.ZIP / EXAM1 / FUNZIP.PRG
Text File  |  1998-04-06  |  2KB  |  62 lines

  1. * (c) TopSpeedSoft 1998
  2. * This is a example of using TopSpeed Unzip DLL for Windows 95 from Visual FoxPro
  3. *
  4. * Compile it with Visual FoxPro 5.0
  5. *
  6. *This example opens zip file, shows its contents
  7. *and test its integrity. Be sure TSUZ.DLL is
  8. *available in directory.
  9.  
  10.  
  11.  
  12. * the path/name of zip file to be tested
  13. * change it to your zip file name
  14. zfn = 'C:\temp\tst\x.zip'
  15.  
  16. * declaring importing functions
  17. declare integer zOpenZipFile in tsuz string zipfilename
  18. declare integer zCloseZipFile in tsuz 
  19. declare integer zGetTotalFiles in tsuz 
  20. declare string zGetFileName in tsuz integer item
  21. declare integer zGetFileSize in tsuz integer item
  22. declare string zGetLastErrorAsText in tsuz 
  23. declare string zGetLastOperResult in tsuz integer item
  24. declare integer zExtractAll in tsuz string extractdir, string pswd, integer OverwriteExisting, integer UseFolders, integer TestOnly, integer RTInfoFunc
  25.  
  26. ? 'Simple Example how to use TopSpeed Unzip DLL for Windows 95'
  27.  
  28. *open zip file
  29. if zOpenZipFile(zfn) <> 0 
  30.     *if there is an error, show it and exit
  31.     ? 'Error: ' + zGetLastErrorAsText()
  32.     return
  33. endif
  34.  
  35. *get number of items in zip file
  36. num_items = zGetTotalFiles()-1;
  37.  
  38. *iterate on list of items and show file name and file size
  39. for i = 0 to num_items do
  40.     ? str(i,4)+' '+zGetFileName(i)+' '+str(zGetFileSize(i),12)
  41. endfor
  42.  
  43. wait window 'Press a key to continue...'
  44.  
  45. *test integrity of all files
  46. if zExtractAll('','',.F.,.F.,.T.,0) <> 0 
  47.     *if there is an error, show it and exit
  48.     ? 'Error: ' + zGetLastErrorAsText()
  49.     return
  50. endif
  51.  
  52. *show report
  53. for i = 0 to num_items do
  54.     ? str(i,4)+' '+zGetFileName(i)+' '+zGetLastOperResult(i)
  55. endfor
  56.  
  57. =zCloseZipFile()
  58. wait window 'Press a key to continue...'
  59.  
  60.  
  61.  
  62.