Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

WinZip files display

Status
Not open for further replies.

tazbrown

Programmer
Feb 13, 2002
7
0
0
US
Does anyone know how to display the file contents of a winzip program onto a form in VB? Any help would be appreciated.

Greg
 
I have some VB that does this, but it's rather ugly, since I couldn't find a simple or clean way to do it.

The way I did it is

- Create a command-line unzipping string:
("E:\WinZip\wzunzip.exe" -vbf "C:\SomeFile.zip" > "C:\TempZipList.txt")

I'll call the command-string 'scmd'

The '-vbf' options are the switches for listing the file contents; check the WinZip helpfiles, which explain all the command-line switches. The last portion of the string is a DOS trick which 'pipes' the results out to a textfile (I learned this from my boss - don't know where it's documented, but it works).

*************

- Then, write the command string out to a batch file, and execute the batch file with a Windows Script Host shell command. This seems like an extra step...but for some reason (the pipe-command I guess, since the WinZip command string alone runs fine with the WiSH.Run command) prevents WSH from running correctly, although no error is generated.

Create Windows Script Host object:
Set oWiSH = CreateObject("WScript.Shell")

Create FileSystemObject (to write command-string to batch file)
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oFile = oFSO.CreateTextFile(sBatchFile, True)
oFile.WriteLine (scmd)
iZipErrCode = oWiSH.Run(sBatchFile, 7, True)

**************

The result is a textfile containing a list of the files in the zip archive. If you want to do anything with the list you'll have to parse the file, as there's a lot of other crap in there besides the filenames.

I think I have the parsing code somewhere if you want it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top