-
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.
-
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.
-
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.
-
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
-
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
-
You can also download some OCX controls called AddZIP Compression Libraries.
-
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...