Newsgroup: it.comp.lang.visual-basic
Titolo: C'è qualcuno che può aiutarmi con questo modulo per zippare

Sarà che sono poco esperto, ma proprio non riesco a farlo funzionare.
Ho trovato il modulo che vi incollo qui sotto in rete e dovrebbe servire per
zippare e unzippare dei file in VB.
Ho copiato i file UNZIP32.DLL e zip32.dll in una cartella raggiungibile dal
programma, ma poi non capisco quale codice devo scrivere per zippare e/o
unzippare un file. C'è qualcuno di voi che potrebbe aiutarmi?
Oltre a zippare e unzippare un file mi servirebbe principalmente zippare e
unzippare inserendo una password nel file ZIP.
Io ho provato a fare una form con due semplici bottoni e il seguente codice
ma non funziona
Private Sub CommandButton1_Click() 'comando per zippare
    Dim a                 'as ????
    a = VBZip(1, "c:\prova.zip", "c:\prova.txt", 1, 1, 1, 1, "non-lo-so")
End Sub
La macro di cui sopra mi dice "By ref argument type mismach" e mi evidenzia
la stringa "c:\prova.txt"
Private Sub CommandButton2_Click() 'comando per unzippare
    Call VBUnzip("c:\prova.zip", "c:\", 0, 0, 0, 1, 0, 0)
End Sub
La macro di cui sopra invece funziona, ma se il file ZIP è protetto da
password mi appare un MsgBox con scritto un numero che vi assicuro non
essere la password.
N.B. Il programma che devo realizzare deve lavorare principalmente con file
protetti da password, la quale deve essere data direttamente dal codice VB e
non dall'utente.
Spero vivamente in un vostro aiuto.
Ringrazio tutti in anticipo.
Ciao da Emiliano
'
Public Type ZIPnames
    s(1 To 100) As String
End Type
'
Public RetValue As Long
'
'ZPOPT is used to set options in the zip32.dll
Private Type ZPOPT
    fSuffix As Long
    fEncrypt As Long
    fSystem As Long
    fVolume As Long
    fExtra As Long
    fNoDirEntries As Long
    fExcludeDate As Long
    fIncludeDate As Long
    fVerbose As Long
    fQuiet As Long
    fCRLF_LF As Long
    fLF_CRLF As Long
    fJunkDir As Long
    fRecurse As Long
    fGrow As Long
    fForce As Long
    fMove As Long
    fDeleteEntries As Long
    fUpdate As Long
    fFreshen As Long
    fJunkSFX As Long
    fLatestTime As Long
    fComment As Long
    fOffsets As Long
    fPrivilege As Long
    fEncryption As Long
    fRepair As Long
    flevel As Byte
    date As String ' 8 bytes long
    szRootDir As String ' up to 256 bytes long
End Type
'
'
'
Private Type ZIPUSERFUNCTIONS
    DllPrnt As Long
    DLLPASSWORD As Long
    DLLCOMMENT As Long
    DLLSERVICE As Long
End Type
'
' Userfunctions structure
'
Private Type USERFUNCTION
    DllPrnt As Long
    DLLSND As Long
    DLLREPLACE As Long
    DLLPASSWORD As Long
    DLLMESSAGE As Long
    DLLSERVICE As Long
    TotalSizeComp As Long
    TotalSize As Long
    CompFactor As Long
    NumMembers As Long
    cchComment As Integer
End Type
' DCL structure
Private Type DCLIST
    ExtractOnlyNewer As Long
    SpaceToUnderscore As Long
    PromptToOverwrite As Long
    fQuiet As Long
    ncflag As Long
    ntflag As Long
    nvflag As Long
    nUflag As Long
    nzflag As Long
    ndflag As Long
    noflag As Long
    naflag As Long
    nZIflag As Long
    C_flag As Long
    fPrivilege As Long
    Zip As String
    ExtractDir As String
End Type
' Unzip32.dll version structure
Private Type UZPVER
    structlen As Long
    flag As Long
    beta As String * 10
    date As String * 20
    zlib As String * 10
    unzip(1 To 4) As Byte
    zipinfo(1 To 4) As Byte
    os2dll As Long
    windll(1 To 4) As Byte
End Type
' Call back "string" (sic)
'Private Type CBChar
'    ch(4096) As Byte
'End Type
' Callback large "string" (sic)
Private Type CBChar
    ch(32000) As Byte
End Type
' Callback small "string" (sic)
Private Type CBCh
    ch(256) As Byte
End Type
'Local declares
Dim MYOPT As ZPOPT
' Dim MYZCL As ZCL
Dim MYUSER As ZIPUSERFUNCTIONS
Dim MYDCL As DCLIST
Dim MYUSER1 As USERFUNCTION
Dim MYVER As UZPVER
Global vbzipnum As Long, vbzipmes As String
Global vbzipinf As String
Global vbzipnam As ZIPnames, vbxnames As ZIPnames
Global crlf$
Private Declare Function ZpInit Lib "zip32.dll" (ByRef Zipfun As
ZIPUSERFUNCTIONS) As Long  ' Set Zip Callbacks
Private Declare Function ZpSetOptions Lib "zip32.dll" (ByRef Opts As ZPOPT)
As Long ' Set Zip options
Private Declare Function ZpGetOptions Lib "zip32.dll" () As ZPOPT ' used to
check encryption flag only
Private Declare Function ZpArchive Lib "zip32.dll" (ByVal argc As Long,
ByVal funame As String, ByRef argv As ZIPnames) As Long ' Real zipping
action
' New Questa funzione non c'e' nella DLL 5.32!!!
Private Declare Function Wiz_SingleEntryUnzip Lib "unzip32.dll" (ByVal ifnc
As Long, ByRef ifnv As ZIPnames, ByVal xfnc As Long, ByRef xfnv As ZIPnames,
dcll As DCLIST, Userf As USERFUNCTION) As Long
'Private Declare Function windll_unzip Lib "unzip32.dll" (ByVal ifnc As
Long, ByRef ifnv As ZIPnames, ByVal xfnc As Long, ByRef xfnv As ZIPnames,
dcll As DCLIST, Userf As USERFUNCTION) As Long
Private Declare Sub UzpVersion2 Lib "unzip32.dll" (uzpv As UZPVER)
' Puts a function pointer in a structure
Function FnPtr(ByVal lp As Long) As Long
    FnPtr = lp
End Function
' Callback for unzip32.dll
Sub ReceiveDllMessage(ByVal ucsize As Long, _
    ByVal csiz As Long, _
    ByVal cfactor As Integer, _
    ByVal mo As Integer, _
    ByVal dy As Integer, _
    ByVal yr As Integer, _
    ByVal hh As Integer, _
    ByVal mm As Integer, _
    ByVal c As Byte, ByRef fname As CBCh, _
    ByRef meth As CBCh, ByVal crc As Long, _
    ByVal fCrypt As Byte)
    Dim s0$, xx As Long
    Dim strout As String * 80
    ' always put this in callback routines!
    On Error Resume Next
    strout = Space(80)
    If vbzipnum = 0 Then
        Mid$(strout, 1, 50) = "Filename:"
        Mid$(strout, 53, 4) = "Size"
        Mid$(strout, 62, 4) = "Date"
        Mid$(strout, 71, 4) = "Time"
        vbzipmes = strout + crlf
        strout = Space(80)
    End If
    s0 = ""
    For xx = 0 To 255
        If 
fname.ch
(xx) = 0 Then xx = 99999 Else s0 = s0 &
Chr$(
fname.ch
(xx))
    Next xx
    Mid$(strout, 1, 50) = Mid$(s0, 1, 50)
    Mid$(strout, 51, 7) = Right$("        " + Str$(ucsize), 7)
    Mid$(strout, 60, 3) = Right$(Str$(dy), 2) + "/"
    Mid$(strout, 63, 3) = Right$("0" + Trim$(Str$(mo)), 2) + "/"
    Mid$(strout, 66, 2) = Right$("0" + Trim$(Str$(yr)), 2)
    Mid$(strout, 70, 3) = Right$(Str$(hh), 2) + ":"
    Mid$(strout, 73, 2) = Right$("0" + Trim$(Str$(mm)), 2)
    ' Mid$(strout, 75, 2) = Right$(" " + Str$(cfactor), 2)
    ' Mid$(strout, 78, 8) = Right$("        " + Str$(csiz), 8)
    ' s0 = ""
    ' For xx = 0 To 255
    '     If 
meth.ch
(xx) = 0 Then xx = 99999 Else s0 = s0 + Chr(
meth.ch
(xx))
    ' Next xx
    vbzipmes = vbzipmes + strout + crlf
    vbzipnum = vbzipnum + 1
    '
    '
End Sub
' Callback for unzip32.dll
Function DllPrnt(ByRef fname As CBChar, ByVal x As Long) As Long
    Dim s0$, xx As Long
    ' always put this in callback routines!
    On Error Resume Next
    s0 = ""
    For xx = 0 To x
        If 
fname.ch
(xx) = 0 Then xx = 99999 Else s0 = s0 + Chr(
fname.ch
(xx))
    Next xx
    vbzipinf = vbzipinf + s0
    DllPrnt = 0
End Function
' Callback for unzip32.dll
Function DllPass(ByRef s1 As Byte, x As Long, _
    ByRef s2 As Byte, _
    ByRef s3 As Byte) As Long
    ' always put this in callback routines!
    On Error Resume Next
    ' not supported - always return 1
    DllPass = 1
End Function
' Callback for unzip32.dll
Function DllRep(ByRef fname As CBChar) As Long
    Dim s0$, xx As Long
    ' always put this in callback routines!
    On Error Resume Next
    DllRep = 100 ' 100=do not overwrite - keep asking user
    s0 = ""
    For xx = 0 To 255
        If 
fname.ch
(xx) = 0 Then xx = 99999 Else s0 = s0 + Chr(
fname.ch
(xx))
    Next xx
    xx = MsgBox("Overwrite " + s0 + "?", vbYesNoCancel, "VBUnzip - File
already exists")
    If xx = vbNo Then Exit Function
    If xx = vbCancel Then
        DllRep = 104 ' 104=overwrite none
        Exit Function
    End If
    DllRep = 102 ' 102=overwrite 103=overwrite all
End Function
' ASCIIZ to String
Function szTrim(szString As String) As String
    Dim pos As Integer, ln As Integer
    pos = InStr(szString, Chr$(0))
    ln = Len(szString)
    Select Case pos
        Case Is > 1
            szTrim = Trim(Left(szString, pos - 1))
        Case 1
            szTrim = ""
        Case Else
            szTrim = Trim(szString)
    End Select
End Function
' Callback for zip32.dll
Function DllComm(ByRef s1 As CBChar) As CBChar
    ' always put this in callback routines!
    On Error Resume Next
    ' not supported always return \0
 
s1.ch
(0) = vbNullString
    DllComm = s1
End Function
' Main subroutine
Sub VBUnzip(fname As String, extdir As String, _
    prom As Integer, ovr As Integer, _
    mess As Integer, dirs As Integer, numfiles As Long, numxfiles As Long)
    Dim xx As Long ' , s1 As String * 20, s2 As String * 256
    ' Set options
    MYDCL.ExtractOnlyNewer = 0      ' 1=extract only newer
    MYDCL.SpaceToUnderscore = 0     ' 1=convert space to underscore
    MYDCL.PromptToOverwrite = prom  ' 1=prompt to overwrite required
    MYDCL.fQuiet = 0                ' 2=no messages 1=less 0=all
    MYDCL.ncflag = 0                ' 1=write to stdout
    MYDCL.ntflag = 0                ' 1=test zip
    MYDCL.nvflag = mess             ' 0=extract 1=list contents
    MYDCL.nUflag = 0                ' 1=extract only newer
    MYDCL.nzflag = 0                ' 1=display zip file comment
    MYDCL.ndflag = dirs             ' 1=honour directories
    MYDCL.noflag = ovr              ' 1=overwrite files
    MYDCL.naflag = 0                ' 1=convert CR to CRLF
    MYDCL.nZIflag = 0               ' 1=Zip Info Verbose
    MYDCL.C_flag = 0                ' 1=Case insensitivity, 0=Case
Sensitivity
    MYDCL.fPrivilege = 0            ' 1=ACL 2=priv
    MYDCL.Zip = fname               ' ZIP name
    MYDCL.ExtractDir = extdir       ' Extraction directory, NULL if
extracting
                                    ' to current directory
    ' Set Callback addresses
    ' Do not change
    MYUSER1.DllPrnt = FnPtr(AddressOf DllPrnt)
    MYUSER1.DLLSND = 0& ' not supported
    MYUSER1.DLLREPLACE = FnPtr(AddressOf DllRep)
    MYUSER1.DLLPASSWORD = FnPtr(AddressOf DllPass)
    MYUSER1.DLLMESSAGE = FnPtr(AddressOf ReceiveDllMessage)
    MYUSER1.DLLSERVICE = 0& ' not coded yet :)
    ' Set Version space
    ' Do not change
    With MYVER
        .structlen = Len(MYVER)
        .beta = Space$(9) & vbNullChar
        .date = Space$(19) & vbNullChar
        .zlib = Space$(9) & vbNullChar
    End With
    ' Get version
    Call UzpVersion2(MYVER)
    'VBUnzFrm.Print MYVER.structlen
    'VBUnzFrm.Print Hex$(MYVER.flag)
    'VBUnzFrm.Print szTrim(MYVER.beta)
    '
    '
    '
    'stampa lo status
    ' MainZip.List1.AddItem
    'VBUnzFrm.Print "DLL Date: " & szTrim(MYVER.date)
    'VBUnzFrm.Print "Zip Info: " & Hex$(MYVER.zipinfo(1)) + "." +
Hex$(MYVER.zipinfo(2)) + Hex$(MYVER.zipinfo(3))
    'VBUnzFrm.Print "DLL Version: " & Hex$(MYVER.windll(1)) + "." +
Hex$(MYVER.windll(2)) + Hex$(MYVER.windll(3))
    'VBUnzFrm.Print "----------"
    '
    '
    '
    'VBUnzFrm.Print szTrim(MYVER.zlib)
    'VBUnzFrm.Print Hex$(MYVER.unzip(1)) + "." + Hex$(MYVER.unzip(2)) +
Hex$(MYVER.unzip(3))
    'VBUnzFrm.Print Hex$(MYVER.os2dll)
    ' Go for it!
    RetValue = Wiz_SingleEntryUnzip(numfiles, vbzipnam, numxfiles, vbxnames,
MYDCL, MYUSER1)
    If RetValue <> 0 Then MsgBox RetValue
    'Debug.Print "--------------"
    'Debug.Print MYUSER.cchComment
    'Debug.Print MYUSER.TotalSizeComp
    'Debug.Print MYUSER.TotalSize
    'Debug.Print MYUSER.CompFactor
    'Debug.Print MYUSER.NumMembers
    'Debug.Print "--------------"
End Sub
'Main Subroutine
Function VBZip(argc As Integer, zipname As String, _
        mynames As ZIPnames, junk As Integer, _
        recurse As Integer, updat As Integer, _
        freshen As Integer, basename As String) As Long
    Dim hmem As Long, xx As Integer
    Dim retcode As Long
    On Error Resume Next ' nothing will go wrong :-)
    ' Set address of callback functions
    MYUSER.DllPrnt = FnPtr(AddressOf DllPrnt)
    MYUSER.DLLPASSWORD = FnPtr(AddressOf DllPass)
    MYUSER.DLLCOMMENT = FnPtr(AddressOf DllComm)
    MYUSER.DLLSERVICE = 0& ' not coded yet :-)
    retcode = ZpInit(MYUSER)
    ' Set zip options
    MYOPT.fSuffix = 0        ' include suffixes (not yet implemented)
    MYOPT.fEncrypt = 0       ' 1 if encryption wanted
    MYOPT.fSystem = 0        ' 1 to include system/hidden files
    MYOPT.fVolume = 0        ' 1 if storing volume label
    MYOPT.fExtra = 0         ' 1 if including extra attributes
    MYOPT.fNoDirEntries = 0  ' 1 if ignoring directory entries
    MYOPT.fExcludeDate = 0   ' 1 if excluding files earlier than a specified
date
    MYOPT.fIncludeDate = 0   ' 1 if including files earlier than a specified
date
    MYOPT.fVerbose = 0       ' 1 if full messages wanted
    MYOPT.fQuiet = 0         ' 1 if minimum messages wanted
    MYOPT.fCRLF_LF = 0       ' 1 if translate CR/LF to LF
    MYOPT.fLF_CRLF = 0       ' 1 if translate LF to CR/LF
    MYOPT.fJunkDir = junk    ' 1 if junking directory names
    MYOPT.fRecurse = recurse ' 1 if recursing into subdirectories
    MYOPT.fGrow = 0          ' 1 if allow appending to zip file
    MYOPT.fForce = 0         ' 1 if making entries using DOS names
    MYOPT.fMove = 0          ' 1 if deleting files added or updated
    MYOPT.fDeleteEntries = 0 ' 1 if files passed have to be deleted
    MYOPT.fUpdate = updat    ' 1 if updating zip file--overwrite only if
newer
    MYOPT.fFreshen = freshen ' 1 if freshening zip file--overwrite only
    MYOPT.fJunkSFX = 0       ' 1 if junking sfx prefix
    MYOPT.fLatestTime = 0    ' 1 if setting zip file time to time of latest
file in archive
    MYOPT.fComment = 0       ' 1 if putting comment in zip file
    MYOPT.fOffsets = 0       ' 1 if updating archive offsets for sfx Files
    MYOPT.fPrivilege = 0     ' 1 if not saving privelages
    MYOPT.fEncryption = 0    'Read only property!
    MYOPT.fRepair = 0        ' 1=> fix archive, 2=> try harder to fix
    MYOPT.flevel = 0         ' compression level - should be 0!!!
    MYOPT.date = vbNullString ' "12/31/79"? US Date?
    MYOPT.szRootDir = basename
    ' Set options
    retcode = ZpSetOptions(MYOPT)
    ' ZCL not needed in VB
    ' MYZCL.argc = 2
    ' MYZCL.filename = "c:\wiz\new.zip"
    ' MYZCL.fileArray = MYNAMES
    ' Go for it!
    retcode = ZpArchive(argc, zipname, mynames)
    VBZip = retcode
End Function

 ha scritto nel messaggio
news:YCN3b.10778$aG6.3...@news1.tin.it...


Ti ringrazio per la risposta e per il codice che mi ha messo a disposizione,
ma purtroppo non sono riuscito a risolvere il problema.
Facciamo un paio di esempi pratici di quello che mi servirebbe (sperando che
tu abbia il tempo e la voglia di aiutarmi)
1° esempio
Ho a disposizione un file "c:\prova.txt" e vorrei zipparlo in "c:\prova.zip"
il quale deve essere protetto dalla password "ciaobimbo"
2°esempio
Ho a disposizione il file "c:\prova.zip" gią protetto dalla password
"ciaobimbo" e contenente un solo file e vorrei unzipparlo in "c:\"; la
password deve essere data direttamente dal codice VB in quanto l'utente non
la deve conoscere per nessun motivo.
Nei miei tentativi con il tuo codice ho copiato in un nuovo modulo il tuo
codice che ti riporto qui sotto:





zipping Action







                    Mid$(strout, 51, 7) = Right$("        " + Str$(ucsize),
7)
                    Mid$(strout, 60, 3) = Right$(Str$(dy), 2) + "/"
                    Mid$(strout, 63, 3) = Right$("0" + Trim$(Str$(mo)), 2) +
"/"
                    Mid$(strout, 66, 2) = Right$("0" + Trim$(Str$(yr)), 2)
                    Mid$(strout, 70, 3) = Right$(Str$(hh), 2) + ":"
                    Mid$(strout, 73, 2) = Right$("0" + Trim$(Str$(mm)), 2)









User











Hex$ (MYVER.zipinfo(2)) + Hex$(MYVER.zipinfo(3))
    'VBUnzFrm.Print "DLL Version: " & Hex$(MYVER.windll(1)) + "." +
Hex$ (MYVER.windll(2)) + Hex$(MYVER.windll(3))




    FLX_Unzip = RetValue
    'vbzipinf










'###########################################################################
'###########################################################################
'###########################################################################
'###########################################################################
'###########################################################################
'###########################################################################
'###########################################################################
'###########################################################################
'###########################################################################
poi nella form con due bottoni ho scritto il seguente codice (che perņ non
ho capito come devo editare):
Private Sub CommandButton1_Click() 'DEVI ZIPPARE IL FILE C:\PROVA.TXT
    FLAG.SalvaPercorso = 1
    FLAG.fNoDirEntries = 0
    FLAG.fRecurse = 0
    FLAG.fUpDate = 0    ' 1 if updating zip file--overwrite only if newer
    FLAG.fFreshen = 0   ' 1 if freshening zip file--overwrite only
    FLAG.szRootDir = "c:\"
    mynames.NameOfFiles(0) = NomeDelFile
    mynames.NameOfFiles(1) = NomeDelFile
    If FLX_Zip(strFileTempZip, 2, mynames, FLAG) = 0 Then
        MsgBox "File zippato"
    End If
End Sub
Private Sub CommandButton2_Click() 'DEVE UNZIPPARE IL FILE C:\PROVA.ZIP
PROTETTO DA PASSWORD
    Dim FLAG                    As FLXt_UnzipFLAG
    Dim Files                   As FLXt_ZipFiles
    Dim ExFiles                 As FLXt_ZipFiles
    'per unzippare
    FLAG.PromptToOverwrite = 0
    FLAG.ExtractDir = "c:\temp\"
    FLAG.Zip = "c:\prova.zip" 'strTempFile
    FLAG.nvflag = 0
    FLAG.noflag = 1
    Files.NameOfFiles(0) = "*.*"
    ExFiles.NameOfFiles(0) = vbNullString
    If FLX_Unzip(FLAG, 1, Files, 0, ExFiles, strFileList) = 0 Then
            MsgBox "Ho unzippato bene sposto il file nel posto giusto"
    End If
End Sub
Potresti aiutarmi all'editare il codice di cui sopra per le mie esigenze?
Ti ringrazio in anticipo.
Ciao da Emiliano


Dammi una mezz'oretta che mi libero da altri impegni e poi ti rispondo
Ciao


Ok, ti concedo la mezzoretta, anche qualcosa di più :-))
Spero tanto di riuscire a risolvere questo problema, infatti quella dello
ZIP sarà un funzione che utilizzerò molto spesso.
Ciao e ancora grazie.
Emiliano

 > Ciao
Scusami per il ritardo, ho scoperto che non ho mai gestito la password,
ci devo pensare un po' prima di capire come funziona.
Non lo mai guardata anche perchè è una criptografia standardizzata e ci
vuole niente a scaricare
qualche programmino che ti sprotegge il file e quindi di solito mi cripto io
i dati con delle mie funzioni
e poi zippo.
Magari le mie funzioni non sono a prova di scardinamento, sono meno
efficienti e tutto quello che vuoi  però ci vuole qualcuno molto
intenzionato al contenuto e che abbia un po' di conoscenze di criptografia
per capire come è
stato creato il file e a sproteggerlo.
Ad esempio una semplice XOR potrebbe bastare, uno guardando il contenuto non
capisce niente anche se è una
banalissima funzione
Comunque ecco il form di prova: le funzioni te le avevo già messe da parte
nell'altro post:
attenzione che manca qualsiasi verifica su esistenza dei file, eventuali
diritti di accesso, ecc ecc
VERSION 5.00
Begin VB.Form Form1
   Caption         =   "Form1"
   ClientHeight    =   3195
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   4680
   LinkTopic       =   "Form1"
   ScaleHeight     =   3195
   ScaleWidth      =   4680
   StartUpPosition =   3  'Windows Default
   Begin VB.CommandButton Command2
      Height          =   555
      Left            =   990
      TabIndex        =   1
      Top             =   1440
      Width           =   1545
   End
   Begin VB.CommandButton Command1
      Caption         =   "Comprimi"
      Height          =   555
      Left            =   990
      TabIndex        =   0
      Top             =   450
      Width           =   1545
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub Command1_Click()
    Dim FLAG                As FLXt_ZipFLAG
    Dim MyNames             As FLXt_ZipFiles
    Dim intRet              As Integer
    Dim strFile             As String
    Dim strFileZip          As String
    Dim strPassword         As String
    strFile = "c:\prova.txt"
    strFileZip = "c:\prova.zip"
    'Ohi ohi: non avevo mai usato la password:
    'Mi sa che devi interagire con la funzione "flx_DllPass"
    strPassword = "ciaobimbo"
    FLAG.fNoDirEntries = 0
    FLAG.fRecurse = 0
    FLAG.fUpDate = 0
    FLAG.fFreshen = 0
    FLAG.szRootDir = "c:\"
    FLAG.SalvaPercorso = 1
    MyNames.NameOfFiles(0) = strFile
    MyNames.NameOfFiles(1) = strFile
    intRet = FLX_Zip(strFileZip, 2, MyNames, FLAG)
    If intRet = 0 Then
        MsgBox "File zippato correttamente"
    End If
End Sub
Private Sub Command2_Click()
    Dim FLAG            As FLXt_UnzipFLAG
    Dim Files           As FLXt_ZipFiles
    Dim ExFiles         As FLXt_ZipFiles
    Dim lngReturn       As Long
    Dim blnMultiple     As Boolean
    Dim strFileList() As String
    Dim strFileListZip() As String
    Dim strFileZip      As String
    strFileZip = "c:\prova.zip"
    'Controllo cosa c'è nello zip
    FLAG.Zip = strFileZip
    FLAG.nvflag = 1
    Files.NameOfFiles(0) = "*.*"
    ExFiles.NameOfFiles(0) = vbNullString
    Screen.MousePointer = vbHourglass
        lngReturn = FLX_Unzip(FLAG, 1, Files, 0, ExFiles, strFileList())
    Screen.MousePointer = vbDefault
    'C'è almeno un archivio?
    If lngReturn <> 0 Then
        MsgBox "Il file non è un archivio compresso valido"
        Exit Sub
    Else
        'Controllo se ci sono più archivi
        blnMultiple = Val(FLX_ZipGetInfo(zipnum)) > 1
        If blnMultiple Then
            MsgBox "Dentro l'archivio compresso sono presenti più archivi" &
vbNewLine & FLX_ZipGetInfo(zipmes)
            Exit Sub
        Else
            'C'è un solo archivio: prendo il suo nome
            MsgBox "Dentro l'archivio compresso è presente " & vbNewLine &
FLX_ZipGetInfo(zipmes)
        End If
    End If
    'Estraggo i file
    FLAG.PromptToOverwrite = 0
    FLAG.ExtractDir = "c:\"
    FLAG.Zip = strFileZip
    FLAG.nvflag = 0
    FLAG.noflag = 1
    Files.NameOfFiles(0) = "*.*"
    ExFiles.NameOfFiles(0) = vbNullString
    lngReturn = FLX_Unzip(FLAG, 1, Files, 0, ExFiles, strFileListZip())
    If lngReturn <> 0 Then
        MsgBox "Non è possibile recuperare i file dentro l'archivio
compresso"
        Exit Sub
    Else
        MsgBox "Files decompressi " & FLX_ZipGetInfo(zipinf)
    End If
End Sub

 ha scritto nel messaggio
news:Axl5b.8212$hE5.2...@news1.tin.it...
