Add ZIP functionality to an app

The place to discuss FoxPro issues not directly related to ProMatrix.

Add ZIP functionality to an app

Postby Bob » Thu Oct 24, 2013 1:58 pm

I've been using DynaZIP to add ZIP capability to an app, but that uses OCX technology an is getting rather hard to maintain.

Anyone know of a better way to integrate creating a ZIP file into VPME?
Bob
 
Posts: 718
Joined: Mon Jun 14, 2010 6:53 am
Location: Near Albany, NY

Re: Add ZIP functionality to an app

Postby stecenko » Thu Oct 24, 2013 2:50 pm

I got this from some where on the Internet (I don't remember where).

WITH thisform
STORE .txtFolderCopied.value TO dlcSource
STORE .txtCopiedTo.Value TO dlcTarget
endwith
IF NOT directory(JUSTPath(dlcTarget))
MKDIR (JUSTPath(dlcTarget))
ENDIF

* create a zip folder by creating a file with the ZIP header bytes:
STORE STRTOFILE(CHR( 80 )+CHR( 75 )+CHR( 5 )+CHR( 6 )+REPLICATE( CHR(0), 18 ), dlcTarget) TO dlnTarget

* copy to the new zip folder via shell.application
oShell = CREATEOBJECT("shell.application")

oShell.NameSpace( dlcTarget ).copyhere( dlcSource, 4096 )


* Hang around until the compression is finished.
Do while oShell.Namespace(dlcTarget).items.Count = 0
WAIT WINDOW "Compressing..." TIMEOUT 2
enddo


I've been using it for years.
Richard Stecenko
Interactive Computer Services Inc.
Victoria, British Columbia
204.453.2052
stecenko
 
Posts: 822
Joined: Mon Jun 21, 2010 8:06 pm
Location: Saanich, British Columbia

Re: Add ZIP functionality to an app

Postby Bob » Fri Oct 25, 2013 6:41 am

Pretty sweet! Thanks!

Avoids all the issues of registering DynaZIP dlls etc ...
Bob
 
Posts: 718
Joined: Mon Jun 14, 2010 6:53 am
Location: Near Albany, NY

Re: Add ZIP functionality to an app

Postby Bob » Fri Oct 25, 2013 10:36 am

This fine from the command window in WIN7 but not in Vista ...

Throws an OLE Error 0x80040154

Does this need a DECLARE statement somewhere?
Bob
 
Posts: 718
Joined: Mon Jun 14, 2010 6:53 am
Location: Near Albany, NY

Re: Add ZIP functionality to an app

Postby DavidLeMesurier » Thu Oct 31, 2013 7:32 am

oshell may also have security issues on some users systems

Have a look at

http://www.sweetpotatosoftware.com/SPSB ... ed8da.aspx

or

http://www.news2news.com/vfp/?example=568

Not sure if this works on vista
DavidLeMesurier
 
Posts: 82
Joined: Sun Jun 13, 2010 12:43 am
Location: Dubai

Re: Add ZIP functionality to an app

Postby Bob » Fri Nov 01, 2013 6:57 am

Thanks! I'll try that today!
Bob
 
Posts: 718
Joined: Mon Jun 14, 2010 6:53 am
Location: Near Albany, NY

Re: Add ZIP functionality to an app

Postby Bob » Fri Dec 20, 2013 7:20 am

The SweetPotato FLL works great! Thanks!
Bob
 
Posts: 718
Joined: Mon Jun 14, 2010 6:53 am
Location: Near Albany, NY


Return to Visual FoxPro

Who is online

Users browsing this forum: No registered users and 1 guest

cron