Home All Groups Group Topic Archive Search About

Reading the contents of a zip file

Author
4 Jun 2005 7:21 PM
Saucer Man
I want to be check the contents of a .zip file for a certain icon(.ico file)
and if it exists, display the icon in a picturebox.  What is the best way to
do this, preferably without third party controls.

--

Thanks.

Author
4 Jun 2005 8:15 PM
Veign
I know you mentioned without 3rd party controls but this may be the easiest
solution:
http://www.vbaccelerator.com/home/VB/Code/Libraries/Compression/Unzipping_Files/article.asp

--
Chris Hanscom - Microsoft MVP (VB)
Veign's Resource Center
http://www.veign.com/vrc_main.asp
--
Read. Decide. Sign the petition to Microsoft.
http://classicvb.org/petition/


Show quoteHide quote
"Saucer Man" <saucerman@nospam.net> wrote in message
news:YPOdnamSiIrXYjzfRVn-tw@adelphia.com...
> I want to be check the contents of a .zip file for a certain icon(.ico
file)
> and if it exists, display the icon in a picturebox.  What is the best way
to
> do this, preferably without third party controls.
>
> --
>
> Thanks.
>
>
>
Author
5 Jun 2005 12:46 AM
Saucer Man
Unzip32.dll would be fine.  Do I actually have to unzip the contents of the
zip to assign the .ico file to the picture box or can I just reference it in
the zip?  I think if I have to unzip everytime I click on an item in the
listview there would be too much disk activity.

--

Thanks.


Show quoteHide quote
"Veign" <NOSPAMinveign@veign.com> wrote in message
news:%239k3BLUaFHA.580@TK2MSFTNGP15.phx.gbl...
>I know you mentioned without 3rd party controls but this may be the easiest
> solution:
> http://www.vbaccelerator.com/home/VB/Code/Libraries/Compression/Unzipping_Files/article.asp
>
> --
> Chris Hanscom - Microsoft MVP (VB)
> Veign's Resource Center
> http://www.veign.com/vrc_main.asp
> --
> Read. Decide. Sign the petition to Microsoft.
> http://classicvb.org/petition/
>
>
> "Saucer Man" <saucerman@nospam.net> wrote in message
> news:YPOdnamSiIrXYjzfRVn-tw@adelphia.com...
>> I want to be check the contents of a .zip file for a certain icon(.ico
> file)
>> and if it exists, display the icon in a picturebox.  What is the best way
> to
>> do this, preferably without third party controls.
>>
>> --
>>
>> Thanks.
>>
>>
>>
>
>
Author
4 Jun 2005 9:13 PM
Bonj
I think you will have to use a 3rd party control (unless you want to do a
LOT of work). But that's not to say there isn't a free one - I think it's
probably likely there is actually.


Show quoteHide quote
"Saucer Man" <saucerman@nospam.net> wrote in message
news:YPOdnamSiIrXYjzfRVn-tw@adelphia.com...
>I want to be check the contents of a .zip file for a certain icon(.ico
>file) and if it exists, display the icon in a picturebox.  What is the best
>way to do this, preferably without third party controls.
>
> --
>
> Thanks.
>
>
>
Author
5 Jun 2005 1:40 AM
Mike D Sutton
> I want to be check the contents of a .zip file for a certain icon(.ico file)
> and if it exists, display the icon in a picturebox.  What is the best way to
> do this, preferably without third party controls.

Have a look at this old post for how to parse a .ZIP file header in VB (no 3rd party libraries required):
http://groups.google.co.uk/group/microsoft.public.vb.general.discussion/msg/af374a38d8cfe0fb
Hope this helps,

    Mike


- Microsoft Visual Basic MVP -
E-Mail: ED***@mvps.org
WWW: Http://EDais.mvps.org/
Author
5 Jun 2005 2:35 AM
Saucer Man
Mike, this is a great way to search the .zip for a file!  Now if I find the
file and I want to load it into a picturebox, do I have to extract it first
or is there a way I can load it from the .zip?

--

Thanks.


Show quoteHide quote
"Mike D Sutton" <ED***@mvps.org> wrote in message
news:%23s%23u$%23WaFHA.1448@TK2MSFTNGP09.phx.gbl...
>> I want to be check the contents of a .zip file for a certain icon(.ico
>> file)
>> and if it exists, display the icon in a picturebox.  What is the best way
>> to
>> do this, preferably without third party controls.
>
> Have a look at this old post for how to parse a .ZIP file header in VB (no
> 3rd party libraries required):
> http://groups.google.co.uk/group/microsoft.public.vb.general.discussion/msg/af374a38d8cfe0fb
> Hope this helps,
>
>    Mike
>
>
> - Microsoft Visual Basic MVP -
> E-Mail: ED***@mvps.org
> WWW: Http://EDais.mvps.org/
>
>
Author
5 Jun 2005 9:22 AM
Mike D Sutton
> Mike, this is a great way to search the .zip for a file!  Now if I find the
> file and I want to load it into a picturebox, do I have to extract it first
> or is there a way I can load it from the .zip?

You would still need to extract it (unless the .ZIP file is stored using no compression in which case you can just offset to the
correct part of the file and read out the bytes - this will not often be the case though..)  Once you find the file you're after
you'll need to fall back on a 3'rd party library to extract the file(s), I'm not sure which method would be faster to parse the
headers but you've got both there should you wish to do some testing.
Hope this helps,

    Mike


- Microsoft Visual Basic MVP -
E-Mail: ED***@mvps.org
WWW: Http://EDais.mvps.org/
Author
5 Jun 2005 12:54 PM
Saucer Man
Thanks all for the help!

--

Thanks.


Show quoteHide quote
"Mike D Sutton" <ED***@mvps.org> wrote in message
news:uHlNIBbaFHA.584@TK2MSFTNGP15.phx.gbl...
>> Mike, this is a great way to search the .zip for a file!  Now if I find
>> the
>> file and I want to load it into a picturebox, do I have to extract it
>> first
>> or is there a way I can load it from the .zip?
>
> You would still need to extract it (unless the .ZIP file is stored using
> no compression in which case you can just offset to the
> correct part of the file and read out the bytes - this will not often be
> the case though..)  Once you find the file you're after
> you'll need to fall back on a 3'rd party library to extract the file(s),
> I'm not sure which method would be faster to parse the
> headers but you've got both there should you wish to do some testing.
> Hope this helps,
>
>    Mike
>
>
> - Microsoft Visual Basic MVP -
> E-Mail: ED***@mvps.org
> WWW: Http://EDais.mvps.org/
>
>
Author
5 Jun 2005 7:03 PM
Lance
using the mUnzip.bas module, the cUnzip.cls class module, and vbuzip.dll
available from
http://www.vbaccelerator.com/home/VB/Code/Libraries/Compression/Unzipping_Files/article.asp

you can do this (watch for word wrap...)

Private WithEvents m_cUnzip As cUnzip
----------------
Private Sub UnzipIcon(strZipFile As String)
    Set m_cUnzip = New cUnzip
    Dim strDestinationFolder As String
    m_cUnzip.ZipFile = strZipFile
    strDestinationFolder = app.path
    m_cUnzip.UnzipFolder = strDestinationFolder

    m_cUnzip.Directory 'Read Zip file contents

    Dim z As Integer
    For z = 1 To m_cUnzip.FileCount
        m_cUnzip.FileSelected(z) = False 'Unselect files in zip file
(because default is to be selected)
    Next z

    Dim strExtTest As String
    For z = 1 To m_cUnzip.FileCount
        'Select all icon files
        If Ucase(Right$(m_cUnzip.Filename(z), 4)) = ".ICO" Then
m_cUnzip.FileSelected(z) = True
    Next z

    m_cUnzip.Unzip 'Uzip the selected files
    Set m_cUnzip = Nothing
End Sub
---------
Lance

Show quoteHide quote
"Saucer Man" <saucerman@nospam.net> wrote in message
news:YPOdnamSiIrXYjzfRVn-tw@adelphia.com...
>I want to be check the contents of a .zip file for a certain icon(.ico
>file) and if it exists, display the icon in a picturebox.  What is the best
>way to do this, preferably without third party controls.
>
> --
>
> Thanks.
>
>
>
Author
5 Jun 2005 7:14 PM
Lance
scratch the "Dim strExtTest as String" part...

Show quoteHide quote
"Lance" <chuckyboy81070-at-onehotpotatoimeanhotmail.com> wrote in message
news:OmKz7EgaFHA.3488@tk2msftngp13.phx.gbl...
> using the mUnzip.bas module, the cUnzip.cls class module, and vbuzip.dll
> available from
> http://www.vbaccelerator.com/home/VB/Code/Libraries/Compression/Unzipping_Files/article.asp
>
> you can do this (watch for word wrap...)
>
> Private WithEvents m_cUnzip As cUnzip
> ----------------
> Private Sub UnzipIcon(strZipFile As String)
>    Set m_cUnzip = New cUnzip
>    Dim strDestinationFolder As String
>    m_cUnzip.ZipFile = strZipFile
>    strDestinationFolder = app.path
>    m_cUnzip.UnzipFolder = strDestinationFolder
>
>    m_cUnzip.Directory 'Read Zip file contents
>
>    Dim z As Integer
>    For z = 1 To m_cUnzip.FileCount
>        m_cUnzip.FileSelected(z) = False 'Unselect files in zip file
> (because default is to be selected)
>    Next z
>
>    Dim strExtTest As String
>    For z = 1 To m_cUnzip.FileCount
>        'Select all icon files
>        If Ucase(Right$(m_cUnzip.Filename(z), 4)) = ".ICO" Then
> m_cUnzip.FileSelected(z) = True
>    Next z
>
>    m_cUnzip.Unzip 'Uzip the selected files
>    Set m_cUnzip = Nothing
> End Sub
> ---------
> Lance
>
> "Saucer Man" <saucerman@nospam.net> wrote in message
> news:YPOdnamSiIrXYjzfRVn-tw@adelphia.com...
>>I want to be check the contents of a .zip file for a certain icon(.ico
>>file) and if it exists, display the icon in a picturebox.  What is the
>>best way to do this, preferably without third party controls.
>>
>> --
>>
>> Thanks.
>>
>>
>>
>
>
Author
7 Jun 2005 2:53 AM
Saucer Man
Thanks a lot Lance!

--

Thanks.


Show quoteHide quote
"Lance" <chuckyboy81070-at-onehotpotatoimeanhotmail.com> wrote in message
news:eH95YLgaFHA.2984@TK2MSFTNGP15.phx.gbl...
> scratch the "Dim strExtTest as String" part...
>
> "Lance" <chuckyboy81070-at-onehotpotatoimeanhotmail.com> wrote in message
> news:OmKz7EgaFHA.3488@tk2msftngp13.phx.gbl...
>> using the mUnzip.bas module, the cUnzip.cls class module, and vbuzip.dll
>> available from
>> http://www.vbaccelerator.com/home/VB/Code/Libraries/Compression/Unzipping_Files/article.asp
>>
>> you can do this (watch for word wrap...)
>>
>> Private WithEvents m_cUnzip As cUnzip
>> ----------------
>> Private Sub UnzipIcon(strZipFile As String)
>>    Set m_cUnzip = New cUnzip
>>    Dim strDestinationFolder As String
>>    m_cUnzip.ZipFile = strZipFile
>>    strDestinationFolder = app.path
>>    m_cUnzip.UnzipFolder = strDestinationFolder
>>
>>    m_cUnzip.Directory 'Read Zip file contents
>>
>>    Dim z As Integer
>>    For z = 1 To m_cUnzip.FileCount
>>        m_cUnzip.FileSelected(z) = False 'Unselect files in zip file
>> (because default is to be selected)
>>    Next z
>>
>>    Dim strExtTest As String
>>    For z = 1 To m_cUnzip.FileCount
>>        'Select all icon files
>>        If Ucase(Right$(m_cUnzip.Filename(z), 4)) = ".ICO" Then
>> m_cUnzip.FileSelected(z) = True
>>    Next z
>>
>>    m_cUnzip.Unzip 'Uzip the selected files
>>    Set m_cUnzip = Nothing
>> End Sub
>> ---------
>> Lance
>>
>> "Saucer Man" <saucerman@nospam.net> wrote in message
>> news:YPOdnamSiIrXYjzfRVn-tw@adelphia.com...
>>>I want to be check the contents of a .zip file for a certain icon(.ico
>>>file) and if it exists, display the icon in a picturebox.  What is the
>>>best way to do this, preferably without third party controls.
>>>
>>> --
>>>
>>> Thanks.
>>>
>>>
>>>
>>
>>
>
>