This example gets information for the zip file named "C:\test\My zip file.zip", and puts the data in various variables that you can use. The example assumes you have placed a button, a listbox and an Xceed Zip control on a form, named Command1, List1 and XceedZip1 respectively.
Visual Basic |
Copy Code |
Private Sub Command1_Click()
Dim TotalFiles As Long Dim CompressedBytes As Long Dim UncompressedBytes As Long Dim CompressionRatio As Integer Dim IsZipFileSpanned As Boolean Dim ResultCode As xcdError
Call XceedZip1.License( "your license key" )
' Set the zip file name (the only property required to be set here) XceedZip1.ZipFilename = "c:\test\My zip file.zip"
' Get the information ResultCode = XceedZip1.GetZipFileInformation(TotalFiles, CompressedBytes, UncompressedBytes, CompressionRatio, IsZipFileSpanned)
' Check the return value If ResultCode <> xerSuccess Then List1.AddItem "Unsuccessful. Error #" & Str(ResultCode) Else List1.AddItem "Successfully retrieved the zip file's info" List1.AddItem "Total number of files: " & Str(TotalFiles) List1.AddItem "Compressed size: " & Str(CompressedBytes) List1.AddItem "Uncompressed size: " & Str(UncompressedBytes) List1.AddItem "Ratio: " & Str(CompressionRatio) & "%" List1.AddItem "Spanned: " & Str(IsZipFileSpanned) End if End Sub |