http://www.le-boite.com  No French translationEnglish translation

 Home > Programming >Zip Processor 

Paris (France)

 Zip Processor
 

 

Zip Processor

One day, I wanted to find an ActiveX DLL to process Zip files for one application. I wanted of course a free dll to do this.

After hours and hours surfing on the web, I was unable to find any free DLL. All what I was able to find were not free and in all cases, it was not allowed to redistribute them bunddled into my application. Then I decided to write my own.

The idea was to reuse the distribution of GNU zip, and to package it into an ActiveX DLL build with Microsoft™ ATL.

Here is the result of my application.

Documentation

First of all, you need to get the DLL from the binary source distribution, extract it on a safe place, and registry it by:

regsvr32 ZipProcessor.dll

Under Visual Basic, you should see "ZipProcessor 1.1" into the list of dependencies.

Under Microsoft® Visual Basic™, you can create a Zip file like this:

Dim comp As New ZipProcessor.Compress
Dim status As Integer


status = comp.OpenZip("foo.zip")
status = comp.CompressFileInZip("inputfile.java", "inputfile.java", 5)
Call comp.CloseZip
Set comp = Nothing

To extract files from a zip, write the following:

Dim unc As New ZipProcessor.Uncompress
Dim status As Integer
Dim stat As Boolean

status = unc.OpenZip("foo.zip")
stat = unc.GotoFirstFile
While (stat)
Dim name As String
name = unc.CurrentFileName
MsgBox "Extracting " & name

status = unc.ExtractCurrentFile(name, True, True)
stat = unc.GotoNextFile
Wend
Call unc.CloseZip
Set unc = Nothing

Where status = ExtractCurrentFile (String name, Boolean bNoPath, Boolean bOverWrite) takes 3 arguments:

String name : The name of the output file.
Boolean bNoPath : Boolean value, if True, then do not take the PATH in account.
Boolean bOverWrite : True if you want to overwrite existing file.
Long status : Returns 0 if successfull

If you want to select one file into the Zip file, you can locate it into the Zip file by:

status = unc.LocateFile("afile.java", True)
name = unc.CurrentFileName
MsgBox "Extracting " & name
status = unc.ExtractCurrentFile(name, True, True)

Where status = LocateFile (String name, Boolean bNoPath) takes 2 arguments:

String name : The name of the file to select
Boolean bNoPath : Boolean value, if True, then do not take the PATH in account.
Long status : Returns 0 if successfull

Download

I have two kinds of packages to download. The sources package and the binary package. If you just need to use the DLL, prefer the binary package. The source package includes all the sources to rebuild the DLL with Microsoft® Visual C++ 6.0™.

269 Kb Zip Processor Sources Wanadoo (France)
29 Kb Zip Processor Binary Wanadoo (France)

License

Since the DLL is based on sources from the GNU distribution, I will reuse the same license than the original base. It is known as "LGPL" license.

 

Copyright © Régis Le Boité 1997-2008