Solved

unzip

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

708 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