Solved

unzip

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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.
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…

828 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