Sample Visual Basic
Code to create a TAR 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 TAR.
''
'' Create the TAR 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 tar 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 Tar
''
Dim Cryptocx As New EasyByte_Software.Cryptocxv7
Cryptocx.LicenseKey = "DEMO"
Cryptocx.SourceFile = names
Cryptocx.DestinationFile = txtTarFile.Text
theResult = Cryptocx.TARCreateTAR
'' 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
tar file was created
Else
MsgBox theResult
End If
'' Free up Memory Resources
''
Set Cryptocx = Nothing
eds: |