Solved

unzip

Posted on 1998-01-07
5
595 Views
Last Modified: 2011-10-03
Anyone have idea how to unzip file in VB ?
given the zip file and the destination directory .

Sorry for the low points, that is all I have now
0
Comment
Question by:seahpc
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 5

Accepted Solution

by:
dirtdart earned 10 total points
ID: 1449839
There's several ways to do it, depending on which scheme you're using.  If you are using pkzip or arj, you can just shell to the programs:

Shell "c:\pkzip\pkunzip.exe c:\zips\myzip.zip"

If you are using Winzip, I don't think there's any way to do it automatically.  Winrar comes with a dll library of zip functions that you can use in the same way as API calls.  If you have a file that has been compressed with the compress utility that comes with VB, then you have to use LzOpen and LzCopy to decompress it.

Type OFSTRUCT
        cBytes As Byte
        fFixedDisk As Byte
        nErrCode As Integer
        Reserved1 As Integer
        Reserved2 As Integer
        szPathName(OFS_MAXPATHNAME) As Byte
End Type

Declare Function LZOpenFile Lib "lz32.dll" Alias "LZOpenFileA" (ByVal lpszFile As String, lpOf As OFSTRUCT, ByVal style As Long) As Long

Declare Function LZCopy Lib "lz32.dll" Alias "LZCopy" (ByVal hfSource As Long, ByVal hfDest As Long) As Long

Declare Sub LZClose Lib "lz32.dll" Alias "LZClose" (ByVal hfFile As Long)

In LzOpenFile, lpszFile is the path and name of the file.  OFSTRUCT is the structure described above.  It has to be present, but you don't have to fill in any of the information.  style tells the call what action to take.  It is described by the OF_ constants found in the Win32Api (they are self explanitory).

In LzCopy, hfSource and hfDest are handles to the source and destination files.  These handles are obtained from the return value of LzOpenFile.


0
 
LVL 3

Expert Comment

by:bigelos
ID: 1449840
I can show you how to do it with Winzip, if you are interested.
0
 
LVL 2

Author Comment

by:seahpc
ID: 1449841
Hi Bigelos,
           I am interested in it, can you show me ?
           By the way , any control for unzipping .

           I found 1 called ActiveZipper . but one funny thing is that you have to provide the sourcefilename (This is ok) but it also require to provide a outputfilename , problem is what if my zip files consist of multiple files ? Bigelos, I will grade dirtdart for his effort but I will not forget about you watch out for the next question , I will name it as your name and then grade you OK .

0
 

Expert Comment

by:joda
ID: 1449842
Just a little comment about zipcontrols.
Try DynaZip, it´s easy used and works perfect.
www.dynazip.com
0
 
LVL 3

Expert Comment

by:bigelos
ID: 1449843
seahpc,

I'll be looking for your question...
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question