|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Reading the contents of a zip fileI 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. 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 -- Show quoteHide quoteChris 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. > > > 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. -- Show quoteHide quoteThanks. "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. >> >> >> > > 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. > > > > I want to be check the contents of a .zip file for a certain icon(.ico file) Have a look at this old post for how to parse a .ZIP file header in VB (no 3rd party libraries required):> and if it exists, display the icon in a picturebox. What is the best way to > do this, preferably without third party controls. 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/ 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? -- Show quoteHide quoteThanks. "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/ > > > Mike, this is a great way to search the .zip for a file! Now if I find the 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> 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? 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/ Thanks all for the help!
-- Show quoteHide quoteThanks. "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/ > > 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. > > > 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. >> >> >> > > Thanks a lot Lance!
-- Show quoteHide quoteThanks. "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. >>> >>> >>> >> >> > >
Subclassing Help
Delphi For VB Developers (again) Reading XML data to VB Variables Scanning for Wordpad.exe program extending Type structure and Run-time error '49': Bad DLL calling convention Adjusting Contrast or Brightness in VB6 Installed Program Comms support VB6 Application version Open Window Explorer in "My Documents" or other Special Fodlers" |
|||||||||||||||||||||||