02-06-2024, 12:56 PM
This seems to work:
Code: (Select All)
Type ziphead
signature As String * 4
version As Integer
flags As Integer
compression As Integer
modtime As Integer
moddate As Integer
crc_32 As Long
compressedSize As Long
uncompressedSize As Long
filenameLen As Integer
extrafieldLen As Integer
End Type
Dim i As Long
Dim filename As String
ReDim filelist(0) As String
filename = "yourfile.zip"
zipfilearray filename, filelist()
For i = 0 To UBound(filelist)
Print Chr$(34); filelist(i); Chr$(34)
Next i
Sub zipfilearray (zipfile As String, strarr() As String)
Dim head As ziphead
Dim ff As Long
Dim fname As String
Dim filecount As Long
ReDim strarr(0) As String
If Not _FileExists(zipfile) Then Exit Sub
ff = FreeFile
Open zipfile For Binary As ff
Do
Get ff, , head
If head.signature <> Chr$(&H50) + Chr$(&H4B) + Chr$(&H03) + Chr$(&H04) Then Exit Do
fname = Space$(head.filenameLen)
Get ff, , fname
If filecount > UBound(strarr) Then ReDim _Preserve strarr(filecount) As String
strarr(filecount) = fname
filecount = filecount + 1
Seek ff, Seek(ff) + head.extrafieldLen + head.compressedSize
Loop Until EOF(ff)
End Sub