CodeGuru: Zip and Unzip Using VB5 or VB6
This code shows how to use the freeware InfoZip Zip32.DLL and Unzip32.DLL files from the http://www.cdrom.com/pub/infozip/ website. I've included the two dll's in the download file at the end of this article.
The InfoZip DLL's are open-source DLL's that are available for programmers to utilise free of charge. They are standard C DLL's and were very tricky/impossible to interface with VB until VB5/6 offered the 'addressof' operator.
I based this code on the Zip/Unzip examples that come with the downloadable DLL's and encapsulated that code into re-usable class modules that can either be used in an ActiveX DLL, or just placed into your project as required. The downloadable project contains the source-code for an ActiveX DLL called CGZipLibrary and a sample project which uses that DLL.
The example program simply takes everything in it's own directory and zip's it into a file.
You can then unzip this file straight into the TEMP directory. You can check the structure of the Zip file using WinZip (or similar) if you want to check that the Zip is intact (I've had no problems with it at all).
The Class Modules CGZipFiles and CGUnzipFiles have a lot of properties - it's worth reading through the code in these classes to learn how to get the best from them.
Downloads:
1854_cgziplib.zip - Download library file - 174 Kb
Chris Eastwood, March 15, 2004