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

The Easiest Way to Create ZIP File in VFP...(2 lines only) 10

Status
Not open for further replies.

andreateh

Programmer
Jul 19, 2003
83
SG
This is my first time post tips. Hope it can help your guys. Please feel free to comment, since it is a idea from the vbscript forum.

Download File Below (Freeware):

Xzip.dll

From
(navigate to "products" and then scroll down and look for their zip component)

or



1.After download the file.Follow Link Below to Read the Installation Instruction :


2. Now u can create a zip file in VFP with line below :

Code:
oZip = CreateObject("XStandard.Zip")
oZip.Pack "C:\Temp\*.jpg", "C:\Temp\images.zip"

3. Unzip a zipfile with line below :
Code:
oZip = CreateObject("XStandard.Zip")
oZip.UnPack "C:\Temp\images.zip", "C:\Temp\"

Idea come from a thread from :
zip folders
thread329-715047
in the VbScript Forum.
 
Hi,
The DLL is called xGzip.dll
I could do registration without problems
Following your instructions my try ends up with errormessage: Classdefinition XgStandard.Zip is not found.
-Bart
 
If you plan to use Gzip. You may try line below for Gzipped:

Code:
objTAR = CreateObject("XStandard.TAR")
objGZip = CreateObject("XStandard.GZip")
objTAR.Pack "C:\Temp\golf.jpg", "C:\Temp\images.tar"
objTAR.Pack "C:\Temp\racing.gif", "C:\Temp\images.tar"
objGZip.Compress "C:\Temp\images.tar", "C:\Temp\images.tar.gz"

To UnGzip :

Code:
objGZip = Server.CreateObject("XStandard.GZip")
objGZip.Decompress "C:\Temp\images.tar.gz", "C:\Temp"
 
andreateh,

You should consider making a FAQ out of this...the ability to make ZIP, TAR, and GZ files is pretty useful stuff. Star to you!

Slighthaze = NULL
craig1442@mchsi.com
"Whom computers would destroy, they must first drive mad." - Anon​
 
andreateh,
thanks,
I tried your original and found a slight error in your example:
oZip.Pack "C:\Temp\*.jpg", "C:\Temp\images.zip"

should be :
oZip.Pack ( "C:\Temp\*.jpg", "C:\Temp\images.zip" )

further it's ok !
a real neat way to zip/unzip !

thanks for sharing your knowledge and star from me too

-Bart

 
Will try to write the FAQ about this soon.
 
andrea,

ei, tried it with a lil tweaking n i love it! simple and yet very functional. here's another star from me to you.

kilroy [trooper]
philippines
"and that's what we call creativity..."
 
torturedmind ,
Thanks for the star.. can you share out that what have been tweak. I found out that if :

Code:
oZip = CreateObject("XStandard.Zip")
oZip.Pack(
"C:\Temp\*.*"
Code:
, "C:\Temp\images.zip")

All files and subfolder in "C:\TEMP", like "c:\TEMP\X","c:\temp\x\y" will be zip.Same as the -r in pkzip

But,

Code:
oZip = CreateObject("XStandard.Zip")
oZip.Pack(
"C:\Temp\fg*.*"
Code:
, "C:\Temp\images.zip")

Only zip all the file start with fg in the current folder.

and line below may not work as what u expected (a dummy file will be create in the zip file):

Code:
oZip = CreateObject("XStandard.Zip")
oZip.Pack(
"C:\Temp\fg*.TXT"
Code:
, "C:\Temp\images.zip")

When u open the zip file a dummy file fg*.txt is created in the images.zip
 
andreateh,

Hmmmm.... I guess you deserve another star from me!


Bren
VFP - Philippines

 
It's posible to see the progress of ziping and unziping?
Good work
Marius
 
I try to register dll in win98se but it's not working.
Why?
Thank you
 
Win98SE:

First I want say that I have no problem to register xstandard-zip on Win98SE.

However in other fox forum (not in eng language), someone said about same problem, as you have. Answer from other person was, that not correct support for ATL (MS-Active Template Library) is installed.

So I think, you can try install all windows updates from to have proper support.

See faqs on and find: Q. What are the reasons an ATL server might fail to register?

On my Win98 machine ATL.DLL has date 07/19/2002 and OLEAUT32.DLL 06/08/2000.

Please, give me feedback, if Windows update has repaired the problem. Because I want have a good ZIP solution, which I can distribute to different Win systems.

Or, you can try MoleZip freeware, as I write in another thread today.
 
I tried the latest version of the component and the "dummy file fg*.txt" bug is fixed.
 
Fantastic.
If I could give 5 stars I would do it.
Take one star anyway.
Ken F
 
I just downloaded and tried the zip dll and while it's certainly easy to use I found that it didn't compress the files nearly as much as PKZip did. Perhaps there is something I'm missing.

I used 10 files, including a VFP exe, totaling about 3.8 MB

XStandard got it down to about 2.6 MB
PKZip to it down to about 800 KB

That's a pretty big difference.

Ralph
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top