> ' Zip a file > Public Function Zip() As Boolean > Dim lcFile As String = "" > Dim llSuccess As Boolean = False > Dim lnReturn As Double = 0 > Dim loByte(21) As Byte > Dim loObject As Object > Dim loDestinationFolder As Shell32.Folder > Dim loFile As Shell32.FolderItem > Dim loProcess As Framework.ProcessFile = New Framework.ProcessFile(oApp) > Dim loShellClass As Shell32.ShellClass = New Shell32.ShellClass > Dim loSourceFolder As Shell32.Folder > > ' Reset everything > lError = False > cError = "" > > ' If we want the default > If Not lWinZip Then > > Try > > ' If the source folder does not exist > If Not oApp.DirectoryExist(cSourceFolder) Then > cError = "The directory " + cSourceFolder + " does not exist." > lError = True > Exit Try > End If > > loSourceFolder = loShellClass.NameSpace(cSourceFolder) > > loByte(0) = 80 : loByte(1) = 75 : loByte(2) = 5 : loByte(3) = 6 > > ' Make an empty PKZip file > File.WriteAllBytes(cDestinationFile, loByte) > > loDestinationFolder = loShellClass.NameSpace(cDestinationFile) > > ' For each file > For Each loObject In oFile > lcFile = loObject(1) > > ' If the file does not exist > If Not oApp.FileExist(cSourceFolder + "\" + lcFile) Then > cError = "The file " + cSourceFolder + "\" + lcFile + " does not exist." > > ' Remove the temporary file > If Not oApp.DeleteFile(cDestinationFile) Then > > End If > > lError = True > Exit Try > End If > > loFile = loSourceFolder.Items.Item(lcFile) > loDestinationFolder.CopyHere(loFile, 20) > Next > > llSuccess = True > Catch loError As Exception > lError = True > cError = loError.Message > End Try > > Else >>