dovrebbe esserci tuttocodice:Public Type ZIPnames s(0 To 99) As String End Type Public 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 byte szRootDir As String ' fino a 256 byte End Type Public Type ZIPUSERFUNCTIONS DLLPrnt As Long DLLPASSWORD As Long DLLCOMMENT As Long DLLSERVICE As Long End Type Public Type CBChar ch(4096) As Byte End Type Public Declare Function ZpInit Lib "zip32.dll" (ByRef Zipfun As ZIPUSERFUNCTIONS) As Long Public Declare Function ZpSetOptions Lib "zip32.dll" (ByRef Opts As ZPOPT) As Long Public Declare Function ZpArchive Lib "zip32.dll" (ByVal argc As Long, ByVal funame As String, ByRef argv As ZIPnames) As Long Function Stampa_messaggi_zip(ByRef fname As CBChar, ByVal lenght As Long) As Long Dim Messaggio As String ' conterrà il messaggio Dim i As Long ' lunghezza in byte del messaggio On Error Resume Next 'sempre necessario nelle funzioni di callback ' ricostruisco il messaggio a partire dalla stringa di byte For i = 0 To lenght If fname.ch(i) = 0 Then Exit For Else Messaggio = Messaggio + Chr(fname.ch(i)) Next i Debug.Print "" & Messaggio DoEvents Stampa_messaggi_zip = 0 End Function Function Puntatore(ByVal lp As Long) As Long Puntatore = lp End Function 'questo è il codice per zippare Private Sub command1_click() Dim MYUSER As ZIPUSERFUNCTIONS Dim retcode As Long MYUSER.DLLPrnt = Puntatore(AddressOf Stampa_messaggi_zip) 'callback MYUSER.DLLPASSWORD = 0& MYUSER.DLLCOMMENT = 0& MYUSER.DLLSERVICE = 0& ' Gli ultimi tre valori non sono utilizzati. retcode = ZpInit(MYUSER) Dim MYOPT As ZPOPT MYOPT.fForce = 0 MYOPT.fMove = 0 retcode = ZpSetOptions(MYOPT) Dim files As ZIPnames Dim zipName As String ' inseriamo l'elenco dei file nella struttura ZIPnames, precedentemente dichiarata files.s(0) = "miofile.pdf" files.s(1) = "miofile2.pdf" files.s(2) = "ciao.txt" ' ora decidiamo il nome dell’archivio che stiamo preparando: zipName = DestFile ' … e ora richiamiamo la funzione ZpArchive, con i seguenti parametri: ' – numero di file da zippare ' – nome dell’archivio ' – elenco dei file retcode = ZpArchive(3, zipName, files) End Sub