This project is read-only.

Using dotnetzip from classic vb6

Dec 26, 2011 at 8:58 PM
Edited Dec 26, 2011 at 9:00 PM

This is a pretty elementary question as I'm pretty new at this. I would like to use dotnetzip to unzip a file in my vb6 application. My hope is that by doing this I'll be able to deploy the app using ClickOnce. Right now I can deploy the app OK, but the dll I'm using (CGZipLibrary.dll) doesn't deploy correctly and after several days I decided to try a different tack.

I've never tried to use a .NET dll with vb6. I've G'd around and found things like regasm, I need to build a table, etc. that I think are not what I need to do. I had hoped I could drop Ionic.Zip.Reduced.dll into my VB6 directory, register it with regsvr32, create a reference to it and use it. I think I'm missing something.

Once I get this usable with VB6, how do I use it's methods? Sorry to be so newbie.



Dec 27, 2011 at 5:25 PM

Some progress.

  1. Used regasm to get a .tlb file
  2. Used GACUtil to register with the GAC
  3. From VB6 I referenced the .tlb file
  4. Object browser in VB6 sees the dll now.

Remaining problem is that I can't instantate it.

  1. dim theObj as object
  2. Set theObj = CreateObject("Ionic_Zip_Reduced")  --> the error, "ActiveX component can't create object"

But if I do this:

  1. dim theObj as object
  2. theObj = New Ionic_Zip_Reduced    --> the error "Expected user-defined type, not project"

Is there some reference I need? Here is the list of my references:

  • Visual Basic for Applications
  • VIsual Basic runtime objects and procedures
  • Visual Basic objects and procedures
  • a library for handling zip archives (this is the Ionic_Zip_Reduced dll)
  • Microsoft ActiveX Data Objects 6.0 Library
Dec 29, 2011 at 9:40 PM

Check the documentation for DotNetZip.

  • There's a way to use the library within COM environments.
  • There are example code snips in the doc.
  • The COM object in question is not Ionic_Zip_Reduced.
  • There is even an installer package you can use to install the required runtime (does the requisite regasm, etc)

To be honest I cannot recall now whether the reduced library has the COM goodies.  Maybe.  But the main library is the one that I expect people to use on VB6 and COM projects.  It is the one that gets installed with the runtime installer.

Read the documentation.