kenshaw
asked on
need a VB6 zipping component adn a compatible .net one
I have a vb6 client that needs a SMALL dll to use to zip some files (i just want minimal zip functionality) - but I also need a compatible .net component to run on the server side to decompress the files compressed on the client.
does anyone know any? Xceed have good libraries - but their client side zip ActiveX is 500 KB - which is way too big
does anyone know any? Xceed have good libraries - but their client side zip ActiveX is 500 KB - which is way too big
ASKER
no - i need to zip and unzip
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
but thats only for VB6 - then i need somethign for .net on the server side
aren't there issues with getting different zip libraries to interoperate? thats why i thought it was a good idea to get two components from one vendor...
aren't there issues with getting different zip libraries to interoperate? thats why i thought it was a good idea to get two components from one vendor...
what if you call zip via the shell command...
Hi Kenshaw,
I don't understand why you say hes's dlls are only for VB6. They are just some WIN32 DLLs, and it's obvious that you can use them with VB.net as well.
I don't understand why you say hes's dlls are only for VB6. They are just some WIN32 DLLs, and it's obvious that you can use them with VB.net as well.
ASKER
hmm... but its not managed code - and its not going to scale well on a webserver - which is why i want a .net native component for the server side.
i can hack it up using those dll's sure... but its not going to scale well or safely
i can hack it up using those dll's sure... but its not going to scale well or safely
'For XP+ OS
'sSource - can be file or folder
'sDest - zip file path
Public Function vbZIP(ByVal sSource As String, ByVal sDest As String) As Boolean
Dim lAttr As Long, lInitialLength As Long
lAttr = GetFileAttributes(sSource)
If lAttr = -1 Then Exit Function
Dim sZipHeader As String
' sZipHeader = Chr(80) & Chr(75) & Chr(5) & Chr(6) & String(18, Chr(0))
sZipHeader = "PK" & Chr(5) & Chr(6) & String(18, Chr(0))
If Dir(sDest) <> "" Then Kill sDest
Dim nFile As Integer
nFile = FreeFile
Open sDest For Output As #nFile
Print #nFile, sZipHeader
Close #nFile
lInitialLength = FileLen(sDest)
Dim oShell, oSource
Set oShell = CreateObject("Shell.Applic ation")
'Copy the file(s) to the compressed folder
If (lAttr And vbDirectory) = vbDirectory Then
Set oSource = oShell.NameSpace(CVar(sSou rce)).Item s
Else
Set oSource = oShell.NameSpace(CVar(GetP arentFolde r(sSource) )).ParseNa me(GetFile Title(sSou rce))
End If
If Not oSource Is Nothing Then
oShell.NameSpace(CVar(sDes t)).CopyHe re oSource, &H615
Else
GoTo ErrZip
End If
Do While Dir(sDest) = ""
DoEvents
Sleep 100
Loop
On Error Resume Next
Do While FileLen(sDest) = lInitialLength
DoEvents
Sleep 100
Loop
'wait for lock to release
On Error Resume Next
Do
'Attempt to open the file, this causes an Err 70,
'Permission Denied when the file is already open
nFile = FreeFile
Open sDest For Append As #nFile
Close #nFile
If Err = 0 Then Exit Do
Sleep 100
Err.Clear
Loop
vbZIP = True
ErrZip:
Set oSource = Nothing
Set oShell = Nothing
End Function
'sSource - can be file or folder
'sDest - zip file path
Public Function vbZIP(ByVal sSource As String, ByVal sDest As String) As Boolean
Dim lAttr As Long, lInitialLength As Long
lAttr = GetFileAttributes(sSource)
If lAttr = -1 Then Exit Function
Dim sZipHeader As String
' sZipHeader = Chr(80) & Chr(75) & Chr(5) & Chr(6) & String(18, Chr(0))
sZipHeader = "PK" & Chr(5) & Chr(6) & String(18, Chr(0))
If Dir(sDest) <> "" Then Kill sDest
Dim nFile As Integer
nFile = FreeFile
Open sDest For Output As #nFile
Print #nFile, sZipHeader
Close #nFile
lInitialLength = FileLen(sDest)
Dim oShell, oSource
Set oShell = CreateObject("Shell.Applic
'Copy the file(s) to the compressed folder
If (lAttr And vbDirectory) = vbDirectory Then
Set oSource = oShell.NameSpace(CVar(sSou
Else
Set oSource = oShell.NameSpace(CVar(GetP
End If
If Not oSource Is Nothing Then
oShell.NameSpace(CVar(sDes
Else
GoTo ErrZip
End If
Do While Dir(sDest) = ""
DoEvents
Sleep 100
Loop
On Error Resume Next
Do While FileLen(sDest) = lInitialLength
DoEvents
Sleep 100
Loop
'wait for lock to release
On Error Resume Next
Do
'Attempt to open the file, this causes an Err 70,
'Permission Denied when the file is already open
nFile = FreeFile
Open sDest For Append As #nFile
Close #nFile
If Err = 0 Then Exit Do
Sleep 100
Err.Clear
Loop
vbZIP = True
ErrZip:
Set oSource = Nothing
Set oShell = Nothing
End Function
If the need is unzip only then:
ftp://ftp.info-zip.org/pub/infozip/WIN32/unz552dN.zip
There is VB sample code how to use this dll.
Matti