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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

64 bit replacement needed for Dynazip 1

Grandchoir

Programmer
Jul 25, 2024
1
US
I need a 64-bit replacement for Dynazip for use with Visual FoxPro Advanced(x64). Any recommendations?

I can use 7-Zip CLI along with shell_execute, but wondered if anyone has more experience zipping and unzipping files in Visual FoxPro Advanced.

Thank you in advance!

Daniel
 
Thus far, I have been using BandiZip, about 18 months ago I did a lot of testing various zip programs with VFPa
and that was the fastest.

Times change.
 
You could use the Windows API.

To remove files from a zip file:

Code:
    loShell = CREATEOBJECT("shell.application")
    loShell.NameSpace(tcTempPath).CopyHere(loShell.NameSpace(lcZipName).Items, FOF_SILENT)
    lnCnt = 0
    lnCntTot = loShell.NameSpace(lcZipName).Items.Count
    DO WHILE loShell.NameSpace(tcTempPath).Items.Count != lnCntTot
        lnCnt = lnCnt + 1
        apiSleep(100)
        IF lnCnt > lnCntTot
            this.DebugMethod()
        ENDIF
    ENDDO

To add files to a zip file:

Code:
    loShell  = CREATEOBJECT("shell.application")
    loFolder = loShell.NameSpace(tcTempPath).Items
    IF VAL(VERSION(4)) <= 9 .AND. (VAL(OS(3))<6 .OR. VAL(OS(3))=6 .AND. VAL(OS(4))<1)      && Fix for VFPA provided by Doug Hennig; VAL() fix provided by starfiresg1
        FOR EACH loFile IN loFolder
            loShell.NameSpace(tcZipFile).MoveHere(loFile, FOF_SILENT+FOF_NOCONFIRMATION+FOF_NOERRORUI)
            apiSleep(100)
        ENDFOR
    ELSE
        FOR EACH loFile IN loFolder
            lnCountBefore = loShell.NameSpace(tcTempPath).Items.Count
            loShell.NameSpace(tcZipFile).MoveHere(loFile, FOF_SILENT+FOF_NOCONFIRMATION+FOF_NOERRORUI)
            DO WHILE lnCountBefore = loShell.NameSpace(tcTempPath).Items.Count
                apiSleep(50)
            ENDDO
        ENDFOR
    ENDIF
 

Part and Inventory Search

Sponsor

Back
Top