Results 1 to 7 of 7

Thread: Challange...How to unzip comressed(zip) file(s)/Folder(s) using VB code and API...

  1. #1
    Guest

    Question

    Dear Friends,

    I wanted to write a code in my VB application such that, It can read Zip file and can extract files/folders inside it to selected folder...I think I can do this using some APIs or some OCX control if available... But I dont know where to find it....so could you please help me out.

    This all process must be through VB code...no client intraction is required at run time.

  2. #2
    Fanatic Member
    Join Date
    Mar 2000
    Location
    That posh bit of England known as Buckinghamshire
    Posts
    658
    If you remember the good old days of pk(un)Zip, then you will know that that is easy.

    Syntax was something like.

    Code:
    pkzip *.* c:\myZip.Zip
    
    pkUnzip myZip.Zip c:\myFolder
    This is a relativley easy way to go as you can shell it from yuor VB rpogram. If you don't have pkZip i can mail you a copy.
    Iain, thats with an i by the way!

  3. #3
    New Member
    Join Date
    Sep 1999
    Location
    Spain
    Posts
    12
    Hello guy,

    Use o xceedzip component, http://www.xceedsoft.com, it comes with a very good help file, that explains it all, try it, it will solve every problem concerning zipping and unzipping files through VB.

    Good luck.

  4. #4
    PowerPoster Chris's Avatar
    Join Date
    Jan 1999
    Location
    K-PAX
    Posts
    3,238

    Lightbulb Just use Shell Command

    May be you can download the pkzip.exe and pkunzip.exe and just use Shell command to run it.

    If you does wish to see the MSDos promt window, you can use the vbHide at your Shell command.

    Assume both the pkzip.exe and pkunzip.exe is under your application file path.
    Code:
    Shell App.Path & "\pkunzip.exe /bla..bla....bla...", vbHide
    or 
    Shell App.Path & "\pkzip.exe /bla..bla....bla...", vbHide

  5. #5
    Fanatic Member
    Join Date
    Mar 2000
    Location
    That posh bit of England known as Buckinghamshire
    Posts
    658
    Here is an exmaple of very basic usage.

    Code:
    Private Sub Command1_Click()
        'zip up the files
        zipFiles "c:\myfolder\*.*", "c:\mynewfolder\myzip.zip"
        
    End Sub
    
    
    Private Sub Command2_Click()
        'unzip the files
        unzipFiles "c:\mynewfolder\myzip.zip", "c:\myFolder"
        
    End Sub
    
    
    Private Sub zipFiles(stFiles As String, stDestinationFile As String)
        Dim stCommand As String
        
        'build the command to use
        stCommand = "c:\pkzip\pkzip.exe " & stDestinationFile & " " & stFiles
        
        Shell (stCommand)
        
    End Sub
    
    Private Sub unzipFiles(stZipFile As String, stDestination As String)
        Dim stCommand As String
        
        'build the command to use
        stCommand = "c:\pkzip\pkunzip.exe " & stZipFile & " " & stDestination
        
        Shell (stCommand)
        
    End Sub
    Iain, thats with an i by the way!

  6. #6
    Guest
    You can also download some OCX controls called AddZIP Compression Libraries.

  7. #7
    Guest

    Thumbs up

    Dear Friends...

    thank you very much for your very good responce....

    I found the best way is to use some dll.. Which I got from one of your mail.. I think that will work for me...

    To use shell command may reduce the performance and/or gives less flexibility.....so It is not that much better thought... but still we can use it...

    I got mail from Anders Norén who sends me that dll...which you can get from...

    http://www.cdrom.com/pub/infozip/doc/WHERE

    this is cool dll....

    All the Best and Bye...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width