Solved

unzip

Posted on 1998-01-07
5
573 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
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

920 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now