?
Solved

unzip

Posted on 1998-01-07
5
Medium Priority
?
614 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 40 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses

718 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