Sample Visual Basic
Code to create a ZIP file
Where Cryptocx is an instance of a Cryptocx Control.
Where lstFiles
is a listbox that will contain all of the files and or directories
to include in the ZIP.
''
'' Create the Zip file
''
'' Build up the list of Files/Dir to have in the Archive
''
'' They are separated by *
''
Dim names As String
Dim i As Integer
Dim theResult As String
names = ""
'' There are no files or directories specified to add to
a zip file, so can't proceed
''
If lstFiles.ListCount < 1 Then
GoTo eds
End If
For i = 0 To lstFiles.ListCount - 1
names = Trim(lstFiles.List(i)) + "*" + names
Next i
'' Remove the last *
''
names = Mid(names, 1, Len(names) - 1)
'' Now tell Cryptocx to create the Zip
''
Dim Cryptocx As New EasyByte_Software.Cryptocxv7
Cryptocx.LicenseKey = "DEMO"
Cryptocx.SourceFile = names
Cryptocx.DestinationFile = txtZipFile.Text
theResult = Cryptocx.ZIPCreateZIP
'' Check to see what has happened (if the compression went ok without errors)
''
If theResult = "TRUE" Then
'' Ok, the Compression went well with no errors and the zip file was created
Else
MsgBox theResult
End If
'' Free up Memory Resources
''
Set Cryptocx = Nothing
eds: |