Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Craig Boyd vfpCompressin

Status
Not open for further replies.

NasibKalsi

Programmer
Jan 8, 2004
417
CA
Hi All

Any one tried to use Mr. Craig's vfpCompression. Does it have file size limit ? I mean can it create files bigger thn 2GB ? Any side effects ?

Any help will be appreciatd.

My best
 
AFAIK,
no you can't.
And that is because the Visual C++ libraries used there is 32 bits.
But I can be wrong :)

Borislav Borissov
VFP9 SP2, SQL Server 2000,2005 & 2008.
 
Thanks B Borissov.

I tried to use it, and looks very easy to use and have all the needed functionality.

Any suggestions please ?












 
Hi NasibKalsi:

I tried using vfpCompression a few years ago and found it didn't always work. I now use SawZip, freeware, daily to backup all my data files after the last person exits for the day.


Michael Ouellette
 
I use it daily, it is very good - but you do have to take the time to learn its little foilbles.

It will not make a zip in excess of 2GB, because that is the standard for a zip file - you have to use an extended format to make one bigger than that.


Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.
 
Here's my take on using VFPCOMPRESSION.FLL... seems to work very nicely. I haven't tried anything that would get to 2gb yet.

Code:
*---------------------------------------------------------------------
*-- Function F_ZIPUNZIPMGR
*-
*-  Author: Richard A. Snyder
*-              HyperWare Inc. a division of AmTech Software
*-
*-  Parameters: pcAction - ZIP / UNZIP
*-                     pcZipFile - archive file name
*-                     pcZipList - ZIP ( filemask for files to unzip... blank for all)
*-                                    UNZIP ( destination path)
*---------------------------------------------------------------------
LPARAMETERS pcAction, pcZipFile, pcZipList
PRIVATE lc_paction, lc_pzipfile, lc_pziplist
lc_paction = pcAction
lc_pzipfile = pcZipFile
lc_pziplist = pcZipList
IF ATC('\VFPCOMPRESSION.',SET('LIBRARY'))=0
  SET LIBRARY TO LOCFILE([vfpcompression.fll]) ADDITIVE
ENDIF
PRIVATE oZipForm
oZipForm = CREATEOBJECT('zipForm')
oZipForm.SHOW()
oZipForm.ll_zipping = .T.
IF lc_paction = 'ZIP'
  oZipForm.zipit()
ELSE
  oZipForm.unzipit()
ENDIF
lc_dir=oZipForm.lc_curDir
RELEASE oZipForm
SET DEFAULT TO &lc_dir.
RELEASE LIBRARY vfpcompression 
RETURN

FUNCTION ZipStatus
*LPARAMETERS loZipForm
DO CASE
CASE nZipEvent = 0
*!* Do nothing - opening .zip
CASE nZipEvent = 1
  oZipForm.progressmsg.CAPTION = cZipObjectName
CASE nZipEvent = 2
  oZipForm.ln_filebytes = nZipBytes
  oZipForm.fileprogbar.BarVALUE = oZipForm.ln_filebytes/oZipForm.ln_filesize*100
  oZipForm.zipprogbar.BarVALUE = (oZipForm.ln_zipBytes + oZipForm.ln_filebytes)/oZipForm.ln_size*100
  oZipForm.zipprogbar.BarVALUE = IIF(oZipForm.lc_action='UNZIP',(oZipForm.ln_ndx-1)/oZipForm.ln_files*100,oZipForm.zipprogbar.BarValue)
CASE nZipEvent = 3
  oZipForm.ln_zipBytes = oZipForm.ln_zipBytes + oZipForm.ln_filebytes
CASE nZipEvent = 5
*!* Do nothing - closing .zip
ENDCASE
oZipForm.REFRESH()
RETURN

DEFINE CLASS zipForm AS FORM
  WINDOWTYPE = 0
  NAME = 'ZIPUNZIP'
  BACKCOLOR = RGB(232,255,255)
  CAPTION = 'Zip/Unzip'
  AUTOCENTER = .F.
  ALLOWOUTPUT = .T.
  BORDERSTYLE = 1
  MAXBUTTON = .F.
  MINBUTTON = .F.
  HEIGHT = 60
  WIDTH = 400
  TOP = SYSMETRIC(2)-160
  LEFT = SYSMETRIC(1)-800
  SHOWWINDOW = 2
  VISIBLE = .T.
  lc_zipfile = []
  lc_ziplist = []
  lc_action = 'UNZIP'
  lc_srcdir = []
  ll_progbar = .F.
  ll_zipping = .F.
  ln_files = 0
  ln_size = 0
  ln_ndx = 0
  ln_filesize = 0
  ln_filebytes = 0
  ln_zipBytes = 0
  lc_curDir = ADDBS(SYS(5)+SYS(2003))

  PROCEDURE INIT
  THISFORM.ADDOBJECT('fileprogbar','myprogbar')
  THISFORM.ADDOBJECT('zipprogbar','myprogbar')
  THISFORM.ADDOBJECT('ProgressMsg','zipLabel')
  THISFORM.ADDOBJECT('Statusline','zipLabel')
  THISFORM.lc_action = lc_paction
  lc_tmp=lc_pziplist
  DO CASE
  CASE THISFORM.lc_action='ZIP'
    THISFORM.lc_srcdir = IIF(AT('\',lc_tmp)=0,THISFORM.lc_curDir,LEFT(lc_tmp,RAT('\',lc_tmp)))
    THISFORM.lc_ziplist = IIF(AT('\',lc_tmp)=0,lc_tmp,SUBSTR(lc_tmp,RAT('\',lc_tmp)+1))
  OTHERWISE
    THISFORM.lc_srcdir = IIF(TYPE('lc_tmp')='C',lc_tmp,THISFORM.lc_curDir)
  ENDCASE
  THISFORM.lc_zipfile = lc_pzipfile
  THISFORM.CAPTION = IIF(THISFORM.lc_action='ZIP',THISFORM.lc_srcdir,THISFORM.lc_zipfile )
*  thisform.ll_progbar = thisform.f_classreg('MSComctlLib.ProgCtrl.2','MSCOMCTL.OCX')
  WITH THISFORM.fileprogbar
    .TOP = 0
    .LEFT = 0
    .HEIGHT = THISFORM.HEIGHT / 2
    .WIDTH = THISFORM.WIDTH
    .VISIBLE = .T.
    .ENABLED = .T.
  ENDWITH
  WITH THISFORM.zipprogbar
    .TOP = THISFORM.fileprogbar.HEIGHT+1
    .LEFT = 0
    .HEIGHT = THISFORM.HEIGHT / 2
    .WIDTH = THISFORM.WIDTH
    .VISIBLE = .T.
    .ENABLED = .T.
  ENDWITH
  WITH THISFORM.statusline
    .TOP = 0
    .LEFT = 0
    .WIDTH = THISFORM.WIDTH
    .HEIGHT = THISFORM.HEIGHT/2
    .VISIBLE = .T.
  ENDWITH
  WITH THISFORM.progressmsg
    .TOP = THISFORM.HEIGHT/2
    .LEFT = 0
    .WIDTH = THISFORM.WIDTH
    .HEIGHT = THISFORM.HEIGHT/2
    .VISIBLE = .T.
  ENDWITH

  ENDPROC
  PROCEDURE REFRESH
  this.LockScreen = .T.
  =DODEFAULT()
  this.LockScreen = .F.
  ENDPROC

  PROCEDURE zipit
  LOCAL ll_cont
  SET DEFAULT TO (THISFORM.lc_srcdir)
  THISFORM.ln_files = ADIR(laZipList,IIF(ISBLANK(THISFORM.lc_ziplist),[*.*],THISFORM.lc_ziplist))
  THISFORM.ln_size = 0
  FOR THISFORM.ln_ndx=1 TO THISFORM.ln_files
    THISFORM.ln_size = THISFORM.ln_size + laZipList(THISFORM.ln_ndx,2)
  ENDFOR
  ZipCallBack("ZipStatus()")
  lcPath = JUSTPATH(thisform.lc_zipfile)
  lcPath = IIF(EMPTY(lcPath), thisform.lc_curdir, ADDBS(lcPath))
  lcZipFile = JUSTSTEM(thisform.lc_zipfile)+'.ZIP'
  ll_cont=ZipOpen(lcPath+lcZipfile, lcPath, .T.)
  IF ll_cont
    FOR THISFORM.ln_ndx = 1 TO THISFORM.ln_files
      THISFORM.ln_filesize = laZipList(THISFORM.ln_ndx,2)
      THISFORM.ln_filebytes = 0
      THISFORM.progressmsg.CAPTION = laZipList(THISFORM.ln_ndx,1)
      THISFORM.statusline.CAPTION = ALLTRIM(STR(THISFORM.ln_ndx))+' of '+ALLTRIM(STR(THISFORM.ln_files))
      ZipFile(ADDBS(thisform.lc_srcdir)+THISFORM.progressmsg.CAPTION, .T.)
    ENDFOR
  ENDIF
  ZipClose()
  ZipCallBack([])
  RELEASE oZipData, laZipList
  ENDPROC

  PROCEDURE unzipit
  LOCAL ll_cont, ln_files
  ln_files = 0
  IF ATC('\VFPCOMPRESSION.',SET('LIBRARY'))=0
    SET LIBRARY TO LOCFILE([vfpcompression.fll]) ADDITIVE
  ENDIF
  ll_cont=UnZipOpen(THISFORM.lc_zipfile)
  IF ll_cont
   ln_files=UnZipFileCount()
    ll_cont=UnZipSetFolder(THISFORM.lc_srcdir)
  ENDIF
  IF ll_cont
    ZipCallBack("ZipStatus()")
    THISFORM.ln_size = 0
    DIMENSION laFiles(ln_files, 2)
    FOR THISFORM.ln_ndx=1 TO ln_files &&ALEN(laZipList,1)
    =UnzipGotoFileByIndex(thisform.ln_ndx)
    ll_cont=UnZipAFileInfo('laZipList')
      THISFORM.ln_size = THISFORM.ln_size + laZipList(10)
      laFiles(thisform.ln_ndx, 1) = laZipList(1)
      laFiles(thisform.ln_ndx,2) = laZipList(10)
      thisform.statusline.caption = 'Scanning ZIP file.... '+ALLTRIM(STR(THISFORM.ln_ndx))+' of '+ALLTRIM(STR(ln_files))
    ENDFOR
    THISFORM.ln_files = ln_files
    FOR THISFORM.ln_ndx=1 TO ln_files
      THISFORM.ln_filesize = laFiles(thisform.ln_ndx,2)
      THISFORM.ln_filebytes = 0
      THISFORM.progressmsg.CAPTION = laFiles(thisform.ln_ndx,1)
      THISFORM.statusline.CAPTION = ALLTRIM(STR(THISFORM.ln_ndx))+' of '+ALLTRIM(STR(THISFORM.ln_files))
      =UnZipByIndex(THISFORM.ln_ndx)
*      THISFORM.ln_zipBytes = THISFORM.ln_zipBytes + THISFORM.ln_filebytes
    ENDFOR
  ENDIF
  UnZipClose()
  ZipCallBack([])
  RELEASE oZipData, laZipList
  ENDPROC
ENDDEFINE

DEFINE CLASS myprogbar AS CONTAINER
  BACKSTYLE = 0
  BORDERSTYLE = 1
  BarVALUE = 0
  PROCEDURE INIT
  THIS.ADDOBJECT('BarShape','Shape')
  THIS.barshape.WIDTH = 1
  THIS.barshape.VISIBLE = .F.
  THIS.barshape.BACKCOLOR = RGB(100,205,100)
  THIS.barshape.BACKSTYLE = 1
  THIS.barshape.TOP = 0
  THIS.barshape.LEFT = 0
  ENDPROC
  PROCEDURE RESIZE
  THIS.barshape.HEIGHT = THIS.HEIGHT
  ENDPROC
  PROCEDURE REFRESH
  THIS.barshape.WIDTH = THIS.WIDTH * THIS.BarVALUE/100 + 1
  THIS.barshape.VISIBLE = (THIS.BarVALUE # 0)
  ENDPROC
ENDDEFINE

DEFINE CLASS zipLabel AS LABEL
  BACKSTYLE = 0
  FONTNAME = 'Tahoma'
  FONTSIZE = 9
  CAPTION = ''
  FORECOLOR = RGB(0,55,225)
  ALIGNMENT = 2
ENDDEFINE


Andy Snyder
SnyAc Software Services Hyperware Inc. a division of AmTech Software
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top