Home All Groups Group Topic Archive Search About

Unzipping without external DLLs?

Author
12 Sep 2010 3:06 AM
Tony Toews
Folks

I've been doing some searching through Google Groups but haven't found
this answer if there is one.

I"d like to unzip a zip file without using any external DLLs.  I'm
aware of the open source Infozip DLLs and have used them in the past
in Access quite well. 

But this time I'd like VB6 code.  Or is there an API call to use the
Windows zip dll?  I couldn't see one on MSDN but maybe I wasn't
searching with the right keywords either.

(I also realize that a VB6 exe could be significantly slower in
unzipping than the DLLs but I'd be wanting to do a timing test before
deciding that VB6 isn't fast enough.)

Of course zip and unzip are terms used in lots of places so there's a
lot of useless hits.

Thanks, Tony
--
Tony Toews, Microsoft Access MVP
Tony's Main MS Access pages - http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
For a convenient utility to keep your users FEs and other files
  updated see http://www.autofeupdater.com/

Author
12 Sep 2010 5:48 AM
Mike S
On 9/11/2010 8:06 PM, Tony Toews wrote:
Show quoteHide quote
> Folks
>
> I've been doing some searching through Google Groups but haven't found
> this answer if there is one.
>
> I"d like to unzip a zip file without using any external DLLs.  I'm
> aware of the open source Infozip DLLs and have used them in the past
> in Access quite well.
>
> But this time I'd like VB6 code.  Or is there an API call to use the
> Windows zip dll?  I couldn't see one on MSDN but maybe I wasn't
> searching with the right keywords either.
>
> (I also realize that a VB6 exe could be significantly slower in
> unzipping than the DLLs but I'd be wanting to do a timing test before
> deciding that VB6 isn't fast enough.)
>
> Of course zip and unzip are terms used in lots of places so there's a
> lot of useless hits.
>
> Thanks, Tony

This works using VB6, XPSP3, add a reference to shell32.dll shell32.dll.

Sub Compress(dest As String, ZipFile As String)
     Dim myShell As Shell
     Dim FSO As Object
     Set myShell = CreateObject("Shell.Application")
     Set FSO = CreateObject("Scripting.fileSystemObject")
     FSO.CreateTextFile(ZipFile, True).WriteLine "PK" & Chr(5) & Chr(6)
& String(18, 0)
     myShell.NameSpace(ZipFile).CopyHere (dest)
     Set myShell = Nothing
     Set FSO = Nothing
End Sub

Private Sub Command1_Click()
     'change to valid input and output filenames
     Compress "c:\temp\wursetup.exe", "c:\temp\wursetup.zip"
End Sub

http://www.xtremevbtalk.com/showthread.php?t=284538
Author
12 Sep 2010 6:02 AM
Kevin Provance
Top posted:

FSO is a bad idea in any situation.  You are assuming each end user not only
has it on their system, but has the appropriate rights to use it.  It's not
a VB6 only solution.

OP:  My first thought is to look at the info zip source code (assuming it's
still out there) and see if it's translatable to VB6.

Also - and hopefully Dee will be long for this - there was a link posted
recently that dealt with a VB6 zipping program.  I forget the title, but the
source was available.  It does use an external file, zip.exe, however.

If it's possible, and that's a big if, it's not going to be an easy task to
put together (unless you're just going to C&P someone elses code without
understanding how it works...and if so, don't tell me about it).  I would
probably look at the C code for InfoZIP and see if it's translatable to VB

Why not just use the DLL?  You're saving yourself a lot of trouble and work.


Show quoteHide quote
"Mike S" <ms***@yahoo.com> wrote in message
news:i6hpio$v5t$1@news.eternal-september.org...
: On 9/11/2010 8:06 PM, Tony Toews wrote:
: > Folks
: >
: > I've been doing some searching through Google Groups but haven't found
: > this answer if there is one.
: >
: > I"d like to unzip a zip file without using any external DLLs.  I'm
: > aware of the open source Infozip DLLs and have used them in the past
: > in Access quite well.
: >
: > But this time I'd like VB6 code.  Or is there an API call to use the
: > Windows zip dll?  I couldn't see one on MSDN but maybe I wasn't
: > searching with the right keywords either.
: >
: > (I also realize that a VB6 exe could be significantly slower in
: > unzipping than the DLLs but I'd be wanting to do a timing test before
: > deciding that VB6 isn't fast enough.)
: >
: > Of course zip and unzip are terms used in lots of places so there's a
: > lot of useless hits.
: >
: > Thanks, Tony
:
: This works using VB6, XPSP3, add a reference to shell32.dll shell32.dll.
:
: Sub Compress(dest As String, ZipFile As String)
:     Dim myShell As Shell
:     Dim FSO As Object
:     Set myShell = CreateObject("Shell.Application")
:     Set FSO = CreateObject("Scripting.fileSystemObject")
:     FSO.CreateTextFile(ZipFile, True).WriteLine "PK" & Chr(5) & Chr(6)
: & String(18, 0)
:     myShell.NameSpace(ZipFile).CopyHere (dest)
:     Set myShell = Nothing
:     Set FSO = Nothing
: End Sub
:
: Private Sub Command1_Click()
:     'change to valid input and output filenames
:     Compress "c:\temp\wursetup.exe", "c:\temp\wursetup.zip"
: End Sub
:
: http://www.xtremevbtalk.com/showthread.php?t=284538
Author
12 Sep 2010 6:21 AM
Leo
Tony Toews expressed precisely :
Show quoteHide quote
> Folks
>
> I've been doing some searching through Google Groups but haven't found
> this answer if there is one.
>
> I"d like to unzip a zip file without using any external DLLs.  I'm
> aware of the open source Infozip DLLs and have used them in the past
> in Access quite well. 
>
> But this time I'd like VB6 code.  Or is there an API call to use the
> Windows zip dll?  I couldn't see one on MSDN but maybe I wasn't
> searching with the right keywords either.
>
> (I also realize that a VB6 exe could be significantly slower in
> unzipping than the DLLs but I'd be wanting to do a timing test before
> deciding that VB6 isn't fast enough.)
>
> Of course zip and unzip are terms used in lots of places so there's a
> lot of useless hits.
>
> Thanks, Tony

http://www.mvps.org/emorcillo/en/code/vb6/index.shtml

He has a TLB for using the compressed folders api. I linked to his VB6
index as you may need his OLE tlb.

--
ClassicVB Users Regroup! comp.lang.basic.visual.misc
Free usenet access at http://www.eternal-september.org