Easy-to-use Zip ActiveX control with support for multithreading, modern compression algorithms, strong AES encryption, versatile self-extract and more.
Platform:
ActiveX / COM
Licensing:
Royalty-free
Bricolsoft Zip ActiveX makes zip operations a breeze. The component implements a high-level API that allows developers to process data files in batches. There's no hairy, low-level API drudgery here, we've done almost all of the work for you!
Select your programming language to see how easy you can get stuff done:
Zipping Example
This is a basic zipping example. To delve deeper, please see the zipping files quick start and the Zip method help topic.
' Declare
Dim ErrorCode As bzError
' License - use your license key below if registered
BricolsoftZip1.License ("your license key")
' Initialize properties
BricolsoftZip1.ZipFileName = "C:\archive.zip"
BricolsoftZip1.SourceFolder = "C:\folder\"
BricolsoftZip1.FilesToProcess.Items = "*"
' Call the Zip method
ErrorCode = BricolsoftZip1.Zip
' Check the error code
If (ErrorCode <> berrSuccess) Then
MsgBox "Error during operation: " & BricolsoftZip1.GetDescription(bvtError, ErrorCode), vbOKOnly Or vbCritical, "Error"
Else
MsgBox "Operation completed successfully!", vbOKOnly Or vbInformation, "Info"
End If
// Declare
bzError errorCode;
// License - use your license key below if registered
m_BricolsoftZip1.License(_T("your license key"));
// Initialize properties
m_BricolsoftZip1.put_ZipFileName(_T("C:\\archive.zip"));
m_BricolsoftZip1.put_SourceFolder(_T("C:\\folder\\"));
m_BricolsoftZip1.get_FilesToProcess().put_Items(_T("*"));
// Call the Zip method
errorCode = m_BricolsoftZip1.Zip();
// Check the error code
if (errorCode != berrSuccess)
{
MessageBox(CString("Error during operation: ") + CString(m_BricolsoftZip1.GetDescription(bvtError, errorCode)), _T("Error"), MB_OK | MB_ICONERROR);
}
else
{
MessageBox(CString("Operation completed successfully!"), _T("Info"), MB_OK | MB_ICONINFORMATION);
}
// Declare
BricolsoftZip.bzError errorCode;
// License - use your license key below if registered
BricolsoftZip1.License ("your license key");
// Initialize properties
BricolsoftZip1.ZipFileName = "C:\\archive.zip";
BricolsoftZip1.SourceFolder = "C:\\folder\\";
BricolsoftZip1.FilesToProcess.Items = "*";
// Call the Zip method
errorCode = BricolsoftZip1.Zip();
// Check the error code
if (errorCode != BricolsoftZip.bzError.berrSuccess)
{
MessageBox.Show("Error during operation: " + BricolsoftZip1.GetDescription(BricolsoftZip.bzValueType.bvtError, (System.Int32)errorCode), "Error",MessageBoxButtons.OK, MessageBoxIcon.Error);
}
else
{
MessageBox.Show("Operation completed successfully!", "Info",MessageBoxButtons.OK, MessageBoxIcon.Information );
}
' Declare
Dim errorCode As BricolsoftZip.bzError
' License - use your license key below if registered
BricolsoftZip1.License("your license key")
' Initialize properties
BricolsoftZip1.ZipFileName = "C:\archive.zip"
BricolsoftZip1.SourceFolder = "C:\folder\"
BricolsoftZip1.FilesToProcess.Items = "*"
' Call the Zip method
errorCode = BricolsoftZip1.Zip()
' Check the error code
If (errorCode <> BricolsoftZip.bzError.berrSuccess) Then
MessageBox.Show("Error during operation: " & BricolsoftZip1.GetDescription(BricolsoftZip.bzValueType.bvtError, errorCode), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
Else
MessageBox.Show("Operation completed successfully!", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information)
End If
// Declare
bzError errorCode;
// License - use your license key below if registered
m_BricolsoftZip1.License(_T("your license key"));
// Initialize properties
m_BricolsoftZip1.put_ZipFileName(_T("C:\\archive.zip"));
m_BricolsoftZip1.put_SourceFolder(_T("C:\\folder\\"));
m_BricolsoftZip1.get_FilesToProcess().put_Items(_T("*"));
// Call the Zip method
errorCode = m_BricolsoftZip1.Zip();
// Check the error code
if (errorCode != berrSuccess)
{
MessageBox(CString("Error during operation: ") + CString(m_BricolsoftZip1.GetDescription(bvtError, errorCode)), _T("Error"), MB_OK | MB_ICONERROR);
}
else
{
MessageBox(CString("Operation completed successfully!"), _T("Info"), MB_OK | MB_ICONINFORMATION);
}
var
// Declare
errorCode: bzError;
begin
// License - use your license key below if registered
BricolsoftZip1.License ('your license key');
// Initialize properties
BricolsoftZip1.ZipFileName := 'C:\archive.zip';
BricolsoftZip1.SourceFolder := 'C:\folder\';
BricolsoftZip1.FilesToProcess.Items := '*';
// Call the Zip method
ErrorCode := BricolsoftZip1.Zip();
// Check the error code
if (errorCode <> berrSuccess) then begin
MessageDlg('Error during operation: ' + String(BricolsoftZip1.GetDescription(bvtError, errorCode)), mtError, [mbOK], 0);
end else begin
MessageDlg('Operation completed successfully!', mtInformation, [mbOK], 0);
end;
end;
// Declare
bzError errorCode;
// License - use your license key below if registered
BricolsoftZip1->License(WideString("your license key"));
// Initialize properties
BricolsoftZip1->ZipFileName = "C:\\archive.zip";
BricolsoftZip1->SourceFolder = "C:\\folder\\";
BricolsoftZip1->FilesToProcess->set_Items(L"*");
// Call the Zip method
errorCode = BricolsoftZip1->Zip();
// Check the error code
if (errorCode != berrSuccess)
{
MessageDlg("Error during operation: " + AnsiString(BricolsoftZip1->GetDescription(bvtError, errorCode)), mtError, TMsgDlgButtons() << mbOK, 0);
}
else
{
MessageDlg("Operation completed successfully!", mtInformation, TMsgDlgButtons() << mbOK, 0);
}
Unzipping Example
This is a basic unzipping example. To delve deeper, please see the unzipping files quick start
and the Unzip method
help topic.
' Declare
Dim ErrorCode As bzError
' License - use your license key below if registered
BricolsoftZip1.License ("your license key")
' Initialize properties
BricolsoftZip1.ZipFileName = "C:\archive.zip"
BricolsoftZip1.FilesToProcess.Items = "*"
BricolsoftZip1.DestinationFolder = "C:\folder\"
' Call the Unzip method
ErrorCode = BricolsoftZip1.Unzip
' Check the error code
If (ErrorCode <> berrSuccess) Then
MsgBox "Error during operation: " & BricolsoftZip1.GetDescription(bvtError, ErrorCode), vbOKOnly Or vbCritical, "Error"
Else
MsgBox "Operation completed successfully!", vbOKOnly Or vbInformation, "Info"
End If
// Declare
bzError errorCode;
// License - use your license key below if registered
m_BricolsoftZip1.License(_T("your license key"));
// Initialize properties
m_BricolsoftZip1.put_ZipFileName(_T("C:\\archive.zip"));
m_BricolsoftZip1.put_DestinationFolder(_T("C:\\folder\\"));
m_BricolsoftZip1.get_FilesToProcess().put_Items(_T("*"));
// Call the Unzip method
errorCode = m_BricolsoftZip1.Unzip();
// Check the error code
if (errorCode != berrSuccess)
{
MessageBox(CString("Error during operation: ") + CString(m_BricolsoftZip1.GetDescription(bvtError, errorCode)), _T("Error"), MB_OK | MB_ICONERROR);
}
else
{
MessageBox(CString("Operation completed successfully!"), _T("Info"), MB_OK | MB_ICONINFORMATION);
}
// Declare
BricolsoftZip.bzError errorCode;
// License - use your license key below if registered
BricolsoftZip1.License ("your license key");
// Initialize properties
BricolsoftZip1.ZipFileName = "C:\\archive.zip";
BricolsoftZip1.DestinationFolder = "C:\\folder\\";
BricolsoftZip1.FilesToProcess.Items = "*";
// Call the Unzip method
errorCode = BricolsoftZip1.Unzip();
// Check the error code
if (errorCode != BricolsoftZip.bzError.berrSuccess)
{
MessageBox.Show("Error during operation: " + BricolsoftZip1.GetDescription(BricolsoftZip.bzValueType.bvtError, (System.Int32)errorCode), "Error",MessageBoxButtons.OK, MessageBoxIcon.Error);
}
else
{
MessageBox.Show("Operation completed successfully!", "Info",MessageBoxButtons.OK, MessageBoxIcon.Information );
}
' Declare
Dim errorCode As BricolsoftZip.bzError
' License - use your license key below if registered
BricolsoftZip1.License("your license key")
' Initialize properties
BricolsoftZip1.ZipFileName = "C:\archive.zip"
BricolsoftZip1.DestinationFolder = "C:\folder\"
BricolsoftZip1.FilesToProcess.Items = "*"
' Call the Unzip method
errorCode = BricolsoftZip1.Unzip()
' Check the error code
If (errorCode <> BricolsoftZip.bzError.berrSuccess) Then
MessageBox.Show("Error during operation: " & BricolsoftZip1.GetDescription(BricolsoftZip.bzValueType.bvtError, errorCode), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
Else
MessageBox.Show("Operation completed successfully!", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information)
End If
// Declare
bzError errorCode;
// License - use your license key below if registered
m_BricolsoftZip1.License(_T("your license key"));
// Initialize properties
m_BricolsoftZip1.put_ZipFileName(_T("C:\\archive.zip"));
m_BricolsoftZip1.put_DestinationFolder(_T("C:\\folder\\"));
m_BricolsoftZip1.get_FilesToProcess().put_Items(_T("*"));
// Call the Unzip method
errorCode = m_BricolsoftZip1.Unzip();
// Check the error code
if (errorCode != berrSuccess)
{
MessageBox(CString("Error during operation: ") + CString(m_BricolsoftZip1.GetDescription(bvtError, errorCode)), _T("Error"), MB_OK | MB_ICONERROR);
}
else
{
MessageBox(CString("Operation completed successfully!"), _T("Info"), MB_OK | MB_ICONINFORMATION);
}
var
// Declare
errorCode: bzError;
begin
// License - use your license key below if registered
BricolsoftZip1.License ('your license key');
// Initialize properties
BricolsoftZip1.ZipFileName := 'C:\archive.zip';
BricolsoftZip1.FilesToProcess.Items := '*';
BricolsoftZip1.DestinationFolder := 'C:\folder\';
// Call the Unzip method
errorCode := BricolsoftZip1.Unzip();
// Check the error code
if (errorCode <> berrSuccess) then begin
MessageDlg('Error during operation: ' + String(BricolsoftZip1.GetDescription(bvtError, errorCode)), mtError, [mbOK], 0);
end else begin
MessageDlg('Operation completed successfully!', mtInformation, [mbOK], 0);
end;
end;
// Declare
bzError errorCode;
// License - use your license key below if registered
BricolsoftZip1->License(WideString("your license key"));
// Initialize properties
BricolsoftZip1->ZipFileName = "C:\\archive.zip";
BricolsoftZip1->DestinationFolder = "C:\\folder\\";
BricolsoftZip1->FilesToProcess->set_Items(L"*");
// Call the Unzip method
errorCode = BricolsoftZip1->Unzip();
// Check the error code
if (errorCode != berrSuccess)
{
MessageDlg("Error during operation: " + AnsiString(BricolsoftZip1->GetDescription(bvtError, errorCode)), mtError, TMsgDlgButtons() << mbOK, 0);
}
else
{
MessageDlg("Operation completed successfully!", mtInformation, TMsgDlgButtons() << mbOK, 0);
}
' --------------------------------------------------------
' Add the following code to a button’s click event handler
' --------------------------------------------------------
' Declare
Dim ErrorCode As bzError
' License - use your license key below if registered
BricolsoftZip1.License ("your license key")
' Initialize properties
BricolsoftZip1.ZipFileName = "C:\archive.zip"
' Call the List method
ErrorCode = BricolsoftZip1.List
' Check the error code
If (ErrorCode <> berrSuccess) Then
MsgBox "Error during operation: " & BricolsoftZip1.GetDescription(bvtError, ErrorCode), vbOKOnly Or vbCritical, "Error"
Else
MsgBox "Operation completed successfully!", vbOKOnly Or vbInformation, "Info"
End If
' --------------------------------------------------------
' Add the following code to the ListingFile event handler
' that receives notification whenever a new file is listed
' --------------------------------------------------------
' Display listed file
MsgBox "Listing file: " & sFileName
// --------------------------------------------------------
// Add the following code to a button’s click event handler
// --------------------------------------------------------
// Declare
bzError errorCode;
// License - use your license key below if registered
m_BricolsoftZip1.License(_T("your license key"));
// Initialize properties
m_BricolsoftZip1.put_ZipFileName(_T("C:\\archive.zip"));
// Call the List method
errorCode = m_BricolsoftZip1.List();
// Check the error code
if (errorCode != berrSuccess)
{
MessageBox(CString("Error during operation: ") + CString(m_BricolsoftZip1.GetDescription(bvtError, errorCode)), _T("Error"), MB_OK | MB_ICONERROR);
}
else
{
MessageBox(CString("Operation completed successfully!"), _T("Info"), MB_OK | MB_ICONINFORMATION);
}
// --------------------------------------------------------
// Add the following code to the ListingFile event handler
// that receives notification whenever a new file is listed
// --------------------------------------------------------
// Display listed file
MessageBox(CString("Listing file: ") + CString(sFileName), _T("Information"), MB_OK | MB_ICONINFORMATION);
// --------------------------------------------------------
// Add the following code to a button’s click event handler
// --------------------------------------------------------
// Declare
BricolsoftZip.bzError errorCode;
// License - use your license key below if registered
BricolsoftZip1.License ("your license key");
// Initialize properties
BricolsoftZip1.ZipFileName = "C:\\archive.zip";
// Call the List method
errorCode = BricolsoftZip1.List();
// Check the error code
if (errorCode != BricolsoftZip.bzError.berrSuccess)
{
MessageBox.Show("Error during operation: " + BricolsoftZip1.GetDescription(BricolsoftZip.bzValueType.bvtError, (System.Int32)errorCode), "Error",MessageBoxButtons.OK, MessageBoxIcon.Error);
}
else
{
MessageBox.Show("Operation completed successfully!", "Info",MessageBoxButtons.OK, MessageBoxIcon.Information );
}
// --------------------------------------------------------
// Add the following code to the ListingFile event handler
// that receives notification whenever a new file is listed
// --------------------------------------------------------
// Display listed file
MessageBox.Show("Listing file: " + e.sFileName, "ListingFile",MessageBoxButtons.OK, MessageBoxIcon.Information);
' --------------------------------------------------------
' Add the following code to a button’s click event handler
' --------------------------------------------------------
' Declare
Dim errorCode As BricolsoftZip.bzError
' License - use your license key below if registered
BricolsoftZip1.License("your license key")
' Initialize properties
BricolsoftZip1.ZipFileName = "C:\archive.zip"
' Call the List method
errorCode = BricolsoftZip1.List()
' Check the error code
If (errorCode <> BricolsoftZip.bzError.berrSuccess) Then
MessageBox.Show("Error during operation: " & BricolsoftZip1.GetDescription(BricolsoftZip.bzValueType.bvtError, errorCode), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
Else
MessageBox.Show("Operation completed successfully!", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information)
End If
' --------------------------------------------------------
' Add the following code to the ListingFile event handler
' that receives notification whenever a new file is listed
' --------------------------------------------------------
' Display listed file
MessageBox.Show("Listing file: " & e.sFileName, "ListingFile", MessageBoxButtons.OK, MessageBoxIcon.Information)
// --------------------------------------------------------
// Add the following code to a button’s click event handler
// --------------------------------------------------------
// Declare
bzError errorCode;
// License - use your license key below if registered
m_BricolsoftZip1.License(_T("your license key"));
// Initialize properties
m_BricolsoftZip1.put_ZipFileName(_T("C:\\archive.zip"));
// Call the List method
errorCode = m_BricolsoftZip1.List();
// Check the error code
if (errorCode != berrSuccess)
{
MessageBox(CString("Error during operation: ") + CString(m_BricolsoftZip1.GetDescription(bvtError, errorCode)), _T("Error"), MB_OK | MB_ICONERROR);
}
else
{
MessageBox(CString("Operation completed successfully!"), _T("Info"), MB_OK | MB_ICONINFORMATION);
}
// --------------------------------------------------------
// Add the following code to the ListingFile event handler
// that receives notification whenever a new file is listed
// --------------------------------------------------------
// Display listed file
MessageBox(CString("Listing file: ") + CString(sFileName), _T("Information"), MB_OK | MB_ICONINFORMATION);
// --------------------------------------------------------
// Add the following code to a button’s click event handler
// --------------------------------------------------------
var
// Declare
errorCode: bzError;
begin
// License - use your license key below if registered
BricolsoftZip1.License ('your license key');
// Initialize properties
BricolsoftZip1.ZipFileName := 'C:\archive.zip';
// Call the List method
errorCode := BricolsoftZip1.List();
// Check the error code
if (errorCode <> berrSuccess) then begin
MessageDlg('Error during operation: ' + String(BricolsoftZip1.GetDescription(bvtError, errorCode)), mtError, [mbOK], 0);
end else begin
MessageDlg('Operation completed successfully!', mtInformation, [mbOK], 0);
end;
end;
// --------------------------------------------------------
// Add the following code to the ListingFile event handler
// that receives notification whenever a new file is listed
// --------------------------------------------------------
begin:
// Display listed file
MessageDlg('Listing file: ' + String(sFileName), mtWarning, [mbOK], 0);
end;
// --------------------------------------------------------
// Add the following code to a button’s click event handler
// --------------------------------------------------------
// Declare
bzError errorCode;
// License - use your license key below if registered
BricolsoftZip1->License(WideString("your license key"));
// Initialize properties
BricolsoftZip1->ZipFileName = "C:\\archive.zip";
// Call the List method
errorCode = BricolsoftZip1->List();
// Check the error code
if (errorCode != berrSuccess)
{
MessageDlg("Error during operation: " + AnsiString(BricolsoftZip1->GetDescription(bvtError, errorCode)), mtError, TMsgDlgButtons() << mbOK, 0);
}
else
{
MessageDlg("Operation completed successfully!", mtInformation, TMsgDlgButtons() << mbOK, 0);
}
// --------------------------------------------------------
// Add the following code to the ListingFile event handler
// that receives notification whenever a new file is listed
// --------------------------------------------------------
// Display listed file
MessageDlg("Listing file: " + AnsiString(sFileName), mtInformation, TMsgDlgButtons() << mbOK, 0);
Deleting Example
This is a basic deleting example. To delve deeper, please see the deleting files quick start
and the Delete method help topic.
' Declare
Dim ErrorCode As bzError
' License - use your license key below if registered
BricolsoftZip1.License ("your license key")
' Initialize properties
BricolsoftZip1.ZipFileName = "C:\archive.zip"
BricolsoftZip1.FilesToProcess.Items = "file.txt"
' Call the Delete method
ErrorCode = BricolsoftZip1.Delete
' Check the error code and display any errors
If (ErrorCode <> berrSuccess) Then
MsgBox "Error during operation: " & BricolsoftZip1.GetDescription(bvtError, ErrorCode), vbOKOnly Or vbCritical, "Error"
Else
MsgBox "Operation completed successfully!", vbOKOnly Or vbInformation, "Info"
End If
// Declare
bzError errorCode;
// License - use your license key below if registered
m_BricolsoftZip1.License(_T("your license key"));
// Initialize properties
m_BricolsoftZip1.put_ZipFileName(_T("C:\\archive.zip"));
m_BricolsoftZip1.get_FilesToProcess().put_Items(_T("file.txt"));
// Call the Delete method
errorCode = m_BricolsoftZip1.Delete();
// Check the error code
if (errorCode != berrSuccess)
{
MessageBox(CString("Error during operation: ") + CString(m_BricolsoftZip1.GetDescription(bvtError, errorCode)), _T("Error"), MB_OK | MB_ICONERROR);
}
else
{
MessageBox(CString("Operation completed successfully!"), _T("Info"), MB_OK | MB_ICONINFORMATION);
}
// Declare
BricolsoftZip.bzError errorCode;
// License - use your license key below if registered
BricolsoftZip1.License ("your license key");
// Initialize properties
BricolsoftZip1.ZipFileName = "C:\archive.zip";
BricolsoftZip1.FilesToProcess.Items = "file.txt";
// Call the Delete method
errorCode = BricolsoftZip1.Delete();
// Check the error code
if (errorCode != BricolsoftZip.bzError.berrSuccess)
{
MessageBox.Show("Error during operation: " + BricolsoftZip1.GetDescription(BricolsoftZip.bzValueType.bvtError, (System.Int32)errorCode), "Error",MessageBoxButtons.OK, MessageBoxIcon.Error);
}
else
{
MessageBox.Show("Operation completed successfully!", "Info",MessageBoxButtons.OK, MessageBoxIcon.Information );
}
' Declare
Dim errorCode As BricolsoftZip.bzError
' License - use your license key below if registered
BricolsoftZip1.License("your license key")
' Initialize properties
BricolsoftZip1.ZipFileName = "C:\archive.zip"
BricolsoftZip1.FilesToProcess.Items = "file.txt"
' Call the Delete method
errorCode = BricolsoftZip1.Delete()
' Check the error code
If (errorCode <> BricolsoftZip.bzError.berrSuccess) Then
MessageBox.Show("Error during operation: " & BricolsoftZip1.GetDescription(BricolsoftZip.bzValueType.bvtError, errorCode), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
Else
MessageBox.Show("Operation completed successfully!", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information)
End If
// Declare
bzError errorCode;
// License - use your license key below if registered
m_BricolsoftZip1.License(_T("your license key"));
// Initialize properties
m_BricolsoftZip1.put_ZipFileName(_T("C:\\archive.zip"));
m_BricolsoftZip1.get_FilesToProcess().put_Items(_T("file.txt"));
// Call the Delete method
errorCode = m_BricolsoftZip1.Delete();
// Check the error code
if (errorCode != berrSuccess)
{
MessageBox(CString("Error during operation: ") + CString(m_BricolsoftZip1.GetDescription(bvtError, errorCode)), _T("Error"), MB_OK | MB_ICONERROR);
}
else
{
MessageBox(CString("Operation completed successfully!"), _T("Info"), MB_OK | MB_ICONINFORMATION);
}
var
// Declare
errorCode: bzError;
begin
// License - use your license key below if registered
BricolsoftZip1.License ('your license key');
// Initialize properties
BricolsoftZip1.ZipFileName := 'C:\archive.zip';
BricolsoftZip1.FilesToProcess.Items := 'file.txt';
// Call the Delete method
errorCode := BricolsoftZip1.Delete();
// Check the error code
if (errorCode <> berrSuccess) then begin
MessageDlg('Error during operation: ' + String(BricolsoftZip1.GetDescription(bvtError, errorCode)), mtError, [mbOK], 0);
end else begin
MessageDlg('Operation completed successfully!', mtInformation, [mbOK], 0);
end;
end;
// Declare
bzError errorCode;
// License - use your license key below if registered
BricolsoftZip1->License(WideString("your license key"));
// Initialize properties
BricolsoftZip1->ZipFileName = "C:\\archive.zip";
BricolsoftZip1->FilesToProcess->set_Items(L"file.txt");
// Call the Delete method
errorCode = BricolsoftZip1->Delete();
// Check the error code
if (errorCode != berrSuccess)
{
MessageDlg("Error during operation: " + AnsiString(BricolsoftZip1->GetDescription(bvtError, errorCode)), mtError, TMsgDlgButtons() << mbOK, 0);
}
else
{
MessageDlg("Operation completed successfully!", mtInformation, TMsgDlgButtons() << mbOK, 0);
}
' --------------------------------------------------
' Add this code to a button's click event handler
' --------------------------------------------------
' Declare
Dim ErrorCode As bzError
' License - use your license key below if registered
BricolsoftZip1.License ("your license key")
' Initialize properties
BricolsoftZip1.ZipFileName = "C:\archive.zip"
' Call the Zip method
ErrorCode = BricolsoftZip1.Zip
' Check the error code
If (ErrorCode <> berrSuccess) Then
MsgBox "Error during operation: " & BricolsoftZip1.GetDescription(bvtError, ErrorCode), vbOKOnly Or vbCritical, "Error"
Else
MsgBox "Operation completed successfully!", vbOKOnly Or vbInformation, "Info"
End If
' -------------------------------------------------
' Add this code to the RetrievingMemoryFile event
' handler of the BricolsoftZip1 control
' -------------------------------------------------
' Check file name
If (sFileName = "1") Then
' Set file details
sFileName = "file1.txt"
lUncompressedSizeLow = 8
bfaAttributes = bfaReadOnly
dtLastModified = CDate("2009-01-11 1:11:11 PM")
' Indicate that file details were provided
bFileProvided = True
ElseIf (sFileName = "2") Then
' Set file details
sFileName = "file2.txt"
lUncompressedSizeLow = 4
bfaAttributes = bfaReadOnly
dtLastModified = CDate("2009-02-22 2:22:22 PM")
' Indicate that file details were provided
bFileProvided = True
End If
' -------------------------------------------------
' Add this code to the RetrievingBuffer event
' handler of the BricolsoftZip1 control
' -------------------------------------------------
' Declare
Dim aBytes(0 To 3) As Byte
' Check if this is the file we want to add
If (sFileName = "file1.txt") Then
' Set file data - note that COM uses Unicode
' strings, hence this 4 character string takes
' 8 bytes of storage
vaData = "data"
' Indicate that file data was provided
bEndOfData = True
ElseIf (sFileName = "file2.txt") Then
' Alternatively you can use character arrays to
' pass Ansi strings
aBytes(0) = Asc("d")
aBytes(1) = Asc("a")
aBytes(2) = Asc("t")
aBytes(3) = Asc("a")
vaData = aBytes
' Indicate that file data was provided
bEndOfData = True
End If
// --------------------------------------------------
// Add this code to a button's click event handler
// --------------------------------------------------
// Declare
bzError errorCode;
// License - use your license key below if registered
m_BricolsoftZip1.License(_T("your license key"));
// Initialize properties
m_BricolsoftZip1.put_ZipFileName(_T("C:\\archive.zip"));
// Call the Zip method
errorCode = m_BricolsoftZip1.Zip();
// Check the error code
if (errorCode != berrSuccess)
{
MessageBox(CString("Error during operation: ") + CString(m_BricolsoftZip1.GetDescription(bvtError, errorCode)), _T("Error"), MB_OK | MB_ICONERROR);
}
else
{
MessageBox(CString("Operation completed successfully!"), _T("Info"), MB_OK | MB_ICONINFORMATION);
}
// -------------------------------------------------
// Add this code to the RetrievingMemoryFile event
// handler of the BricolsoftZip1 control
// -------------------------------------------------
// Declare
COleDateTime dtTemp;
// Check file name
if (CString(*sFileName) == CString("1"))
{
// Set file details
SysFreeString(*sFileName);
*sFileName = SysAllocString(L"file1.txt");
*lUncompressedSizeLow = 8;
*bfaAttributes = bfaReadOnly;
dtTemp.ParseDateTime("2009-01-11 1:11:11 PM");
*dtLastModified = dtTemp;
// Indicate that file details were provided
*bFileProvided = true;
}
else if (CString(*sFileName) == CString("2"))
{
// Set file details
SysFreeString(*sFileName);
*sFileName = SysAllocString(L"file2.txt");
*lUncompressedSizeLow = 4;
*bfaAttributes = bfaReadOnly;
dtTemp.ParseDateTime("2009-02-22 2:22:22 PM");
*dtLastModified = dtTemp;
// Indicate that file details were provided
*bFileProvided = true;
}
// -------------------------------------------------
// Add this code to the RetrievingBuffer event
// handler of the BricolsoftZip1 control
// -------------------------------------------------
// Declare
HRESULT hr;
SAFEARRAY *psa;
SAFEARRAYBOUND safeBound[1];
char HUGEP *pChar;
// Check if this is the file we want to add
if (CString(sFileName) == CString("file1.txt"))
{
// Set file data - note that COM uses BSTR
// strings, hence this 4 character string takes
// 8 bytes of storage
vaData->vt = VT_BSTR;
vaData->bstrVal = SysAllocString(L"data");
// Indicate that file data was provided
*bEndOfData = VARIANT_TRUE;
}
else if (CString(sFileName) == CString("file2.txt"))
{
// Alternatively you can use character arrays to
// pass Ansi strings
// Set the bounds for first and only dimension
safeBound[0].cElements = 4;
safeBound[0].lLbound = 0;
// Allocate the SAFEARRAY
psa = SafeArrayCreate(VT_UI1,1,safeBound);
// Check result
if (psa != NULL)
{
// Get a pointer to the array data
hr = SafeArrayAccessData(psa, (void HUGEP* FAR*)&pChar);
// Check for success
if (SUCCEEDED(hr))
{
// Place elements into array
pChar[0] = 'd';
pChar[1] = 'a';
pChar[2] = 't';
pChar[3] = 'a';
// Release access
SafeArrayUnaccessData (psa);
// Set return variant fields
vaData->vt = (VT_ARRAY | VT_UI1);
vaData->parray = psa;
// Indicate that file data was provided
*bEndOfData = VARIANT_TRUE;
}
}
}
// --------------------------------------------------
// Add this code to a button's click event handler
// --------------------------------------------------
// Declare
BricolsoftZip.bzError errorCode;
// License - use your license key below if registered
BricolsoftZip1.License ("your license key");
// Initialize properties
BricolsoftZip1.ZipFileName = "C:\\archive.zip";
// Call the Zip method
errorCode = BricolsoftZip1.Zip();
// Check the error code
if (errorCode != BricolsoftZip.bzError.berrSuccess)
{
MessageBox.Show("Error during operation: " + BricolsoftZip1.GetDescription(BricolsoftZip.bzValueType.bvtError, (System.Int32)errorCode), "Error",MessageBoxButtons.OK, MessageBoxIcon.Error);
}
else
{
MessageBox.Show("Operation completed successfully!", "Info",MessageBoxButtons.OK, MessageBoxIcon.Information );
}
// -------------------------------------------------
// Add this code to the RetrievingMemoryFile event
// handler of the BricolsoftZip1 control
// -------------------------------------------------
// Check file name
if (e.sFileName == "1")
{
// Set file details
e.sFileName = "file1.txt";
e.lUncompressedSizeLow = 8;
e.bfaAttributes = BricolsoftZip.bzFileAttributes.bfaReadOnly;
e.dtLastModified = DateTime.Parse("2009-01-11 1:11:11 PM");
// Indicate that file details were provided
e.bFileProvided = true;
}
else if (e.sFileName == "2")
{
// Set file details
e.sFileName = "file2.txt";
e.lUncompressedSizeLow = 4;
e.bfaAttributes = BricolsoftZip.bzFileAttributes.bfaReadOnly;
e.dtLastModified = DateTime.Parse("2009-02-22 2:22:22 PM");
// Indicate that file details were provided
e.bFileProvided = true;
}
// -------------------------------------------------
// Add this code to the RetrievingBuffer event
// handler of the BricolsoftZip1 control
// -------------------------------------------------
// Declare
byte[] bytes = new byte[4];
// Check if this is the file we want to add
if (e.sFileName == "file1.txt")
{
// Set file data - note that COM uses Unicode
// strings, hence this 4 character string takes
// 8 bytes of storage
e.vaData = "data";
// Indicate that file data was provided
e.bEndOfData = true;
}
else if (e.sFileName == "file2.txt")
{
// Alternatively you can use character arrays to
// pass Ansi strings
bytes[0] = (byte)('d');
bytes[1] = (byte)('a');
bytes[2] = (byte)('t');
bytes[3] = (byte)('a');
e.vaData = bytes;
// Indicate that file data was provided
e.bEndOfData = true;
}
' --------------------------------------------------
' Add this code to a button's click event handler
' --------------------------------------------------
' Declare
Dim errorCode As BricolsoftZip.bzError
' License - use your license key below if registered
BricolsoftZip1.License("your license key")
' Initialize properties
BricolsoftZip1.ZipFileName = "C:\archive.zip"
' Call the Zip method
errorCode = BricolsoftZip1.Zip()
' Check the error code
If (errorCode <> BricolsoftZip.bzError.berrSuccess) Then
MessageBox.Show("Error during operation: " & BricolsoftZip1.GetDescription(BricolsoftZip.bzValueType.bvtError, errorCode), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
Else
MessageBox.Show("Operation completed successfully!", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information)
End If
' -------------------------------------------------
' Add this code to the RetrievingMemoryFile event
' handler of the BricolsoftZip1 control
' -------------------------------------------------
' Check file name
If (e.sFileName = "1") Then
' Set file details
e.sFileName = "file1.txt"
e.lUncompressedSizeLow = 8
e.bfaAttributes = BricolsoftZip.bzFileAttributes.bfaReadOnly
e.dtLastModified = CDate("2009-01-11 1:11:11 PM")
' Indicate that file details were provided
e.bFileProvided = True
ElseIf (e.sFileName = "2") Then
' Set file details
e.sFileName = "file2.txt"
e.lUncompressedSizeLow = 4
e.bfaAttributes = BricolsoftZip.bzFileAttributes.bfaReadOnly
e.dtLastModified = CDate("2009-02-22 2:22:22 PM")
' Indicate that file details were provided
e.bFileProvided = True
End If
' -------------------------------------------------
' Add this code to the RetrievingBuffer event
' handler of the BricolsoftZip1 control
' -------------------------------------------------
' Declare
Dim bytes(3) As Byte
' Check if this is the file we want to add
If (e.sFileName = "file1.txt") Then
' Set file data - note that COM uses Unicode
' strings, hence this 4 character string takes
' 8 bytes of storage
e.vaData = "data"
' Indicate that file data was provided
e.bEndOfData = True
ElseIf (e.sFileName = "file2.txt") Then
' Alternatively you can use character arrays to
' pass Ansi strings
bytes(0) = Asc("d")
bytes(1) = Asc("a")
bytes(2) = Asc("t")
bytes(3) = Asc("a")
e.vaData = bytes
' Indicate that file data was provided
e.bEndOfData = True
End If
// --------------------------------------------------
// Add this code to a button's click event handler
// --------------------------------------------------
// Declare
bzError errorCode;
// License - use your license key below if registered
m_BricolsoftZip1.License(_T("your license key"));
// Initialize properties
m_BricolsoftZip1.put_ZipFileName(_T("C:\\archive.zip"));
// Call the Zip method
errorCode = m_BricolsoftZip1.Zip();
// Check the error code
if (errorCode != berrSuccess)
{
MessageBox(CString("Error during operation: ") + CString(m_BricolsoftZip1.GetDescription(bvtError, errorCode)), _T("Error"), MB_OK | MB_ICONERROR);
}
else
{
MessageBox(CString("Operation completed successfully!"), _T("Info"), MB_OK | MB_ICONINFORMATION);
}
// -------------------------------------------------
// Add this code to the RetrievingMemoryFile event
// handler of the BricolsoftZip1 control
// -------------------------------------------------
// Declare
COleDateTime dtTemp;
// Check file name
if (CString(*sFileName) == CString("1"))
{
// Set file details
SysFreeString(*sFileName);
*sFileName = SysAllocString(L"file1.txt");
*lUncompressedSizeLow = 8;
*bfaAttributes = bfaReadOnly;
dtTemp.ParseDateTime("2009-01-11 1:11:11 PM");
*dtLastModified = dtTemp;
// Indicate that file details were provided
*bFileProvided = true;
}
else if (CString(*sFileName) == CString("2"))
{
// Set file details
SysFreeString(*sFileName);
*sFileName = SysAllocString(L"file2.txt");
*lUncompressedSizeLow = 4;
*bfaAttributes = bfaReadOnly;
dtTemp.ParseDateTime("2009-02-22 2:22:22 PM");
*dtLastModified = dtTemp;
// Indicate that file details were provided
*bFileProvided = true;
}
// -------------------------------------------------
// Add this code to the RetrievingBuffer event
// handler of the BricolsoftZip1 control
// -------------------------------------------------
// Declare
HRESULT hr;
SAFEARRAY *psa;
SAFEARRAYBOUND safeBound[1];
char HUGEP *pChar;
// Check if this is the file we want to add
if (CString(sFileName) == CString("file1.txt"))
{
// Set file data - note that COM uses BSTR
// strings, hence this 4 character string takes
// 8 bytes of storage
vaData->vt = VT_BSTR;
vaData->bstrVal = SysAllocString(L"data");
// Indicate that file data was provided
*bEndOfData = VARIANT_TRUE;
}
else if (CString(sFileName) == CString("file2.txt"))
{
// Alternatively you can use character arrays to
// pass Ansi strings
// Set the bounds for first and only dimension
safeBound[0].cElements = 4;
safeBound[0].lLbound = 0;
// Allocate the SAFEARRAY
psa = SafeArrayCreate(VT_UI1,1,safeBound);
// Check result
if (psa != NULL)
{
// Get a pointer to the array data
hr = SafeArrayAccessData(psa, (void HUGEP* FAR*)&pChar);
// Check for success
if (SUCCEEDED(hr))
{
// Place elements into array
pChar[0] = 'd';
pChar[1] = 'a';
pChar[2] = 't';
pChar[3] = 'a';
// Release access
SafeArrayUnaccessData (psa);
// Set return variant fields
vaData->vt = (VT_ARRAY | VT_UI1);
vaData->parray = psa;
// Indicate that file data was provided
*bEndOfData = VARIANT_TRUE;
}
}
}
// --------------------------------------------------
// Add this code to a button's click event handler
// --------------------------------------------------
var
// Declare
errorCode: bzError;
begin
// License - use your license key below if registered
BricolsoftZip1.License ('your license key');
// Initialize properties
BricolsoftZip1.ZipFileName := 'C:\archive.zip';
// Call the Zip method
ErrorCode := BricolsoftZip1.Zip();
// Check the error code
if (errorCode <> berrSuccess) then begin
MessageDlg('Error during operation: ' + String(BricolsoftZip1.GetDescription(bvtError, errorCode)), mtError, [mbOK], 0);
end else begin
MessageDlg('Operation completed successfully!', mtInformation, [mbOK], 0);
end;
end;
// -------------------------------------------------
// Add this code to the RetrievingMemoryFile event
// handler of the BricolsoftZip1 control
// -------------------------------------------------
begin
// Check file name
if (sFileName = '1') then begin
// Set file details
sFileName := 'file1.txt';
lUncompressedSizeLow := 8;
bfaAttributes := bfaReadOnly;
dtLastModified := VarToDateTime('2009-01-11 1:11:11 PM');
// Indicate that file details were provided
bFileProvided := true;
end else if (sFileName = '2') then begin
// Set file details
sFileName := 'file2.txt';
lUncompressedSizeLow := 4;
bfaAttributes := bfaReadOnly;
dtLastModified := VarToDateTime('2009-02-22 2:22:22 PM');
// Indicate that file details were provided
bFileProvided := true;
end;
end;
// -------------------------------------------------
// Add this code to the RetrievingBuffer event
// handler of the BricolsoftZip1 control
// -------------------------------------------------
var
// Declare
aBytesArray: array of byte;
saBytesSafeArray : PSafeArray;
sabArrayBounds : TSafeArrayBound;
pArrayData : pointer;
begin
// Add the following code to the RetrievingBuffer event handler
// Check if this is the file we want to add
if (sFileName = 'file1.txt') then begin
// Set file data - note that COM uses Unicode
// strings, hence this 4 character string takes
// 8 bytes of storage
vaData := 'data';
// Indicate that file data was provided
bEndOfData := true;
end else if (sFileName = 'file2.txt') then begin
// Alternatively you can use character arrays to
// pass Ansi strings.
// Set the bounds for first and only dimension
sabArrayBounds.lLbound:= 0;
sabArrayBounds.cElements:= 4;
// Allocate the SAFEARRAY
saBytesSafeArray := SafeArrayCreate(varByte, 1, sabArrayBounds);
// Get a pointer to the array data
if (SafeArrayAccessData(saBytesSafeArray, pArrayData) = S_OK) then
begin
// Convert pointer to array
aBytesArray := pArrayData;
// Place elements into array
aBytesArray[0] := Ord('d');
aBytesArray[1] := Ord('a');
aBytesArray[2] := Ord('t');
aBytesArray[3] := Ord('a');
end;
// Release access
SafeArrayUnAccessData(saBytesSafeArray);
// Set return variant fields
TVariantArg(vaData).vt := VT_ARRAY or VT_UI1;
TVariantArg(vaData).parray := saBytesSafeArray;
// Indicate that file data was provided
bEndOfData := true;
end;
end;
// -------------------------------------------------
// Locate the uses statement for the unit containing
// the RetrievingBuffer event handler and add
// 'ActiveX' to the statement (see sample uses
// statement with 'ActiveX' added below)
// -------------------------------------------------
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, OleCtrls, ActiveX, BricolsoftZip_TLB;
// --------------------------------------------------
// Add this code to a button's click event handler
// --------------------------------------------------
// Declare
bzError errorCode;
// License - use your license key below if registered
BricolsoftZip1->License(WideString("your license key"));
// Initialize properties
BricolsoftZip1->ZipFileName = "C:\\archive.zip";
// Call the Zip method
errorCode = BricolsoftZip1->Zip();
// Check the error code
if (errorCode != berrSuccess)
{
MessageDlg("Error during operation: " + AnsiString(BricolsoftZip1->GetDescription(bvtError, errorCode)), mtError, TMsgDlgButtons() << mbOK, 0);
}
else
{
MessageDlg("Operation completed successfully!", mtInformation, TMsgDlgButtons() << mbOK, 0);
}
// -------------------------------------------------
// Add this code to the RetrievingMemoryFile event
// handler of the BricolsoftZip1 control
// -------------------------------------------------
// Check file name
if (WideString(*sFileName) == WideString("1"))
{
// Set file details
SysFreeString(*sFileName);
*sFileName = SysAllocString(L"file1.txt");
*lUncompressedSizeLow = 8;
*bfaAttributes = bfaReadOnly;
*dtLastModified = VarToDateTime("2009-01-11 1:11:11 PM");
// Indicate that file details were provided
*bFileProvided = true;
}
else if (WideString(*sFileName) == WideString("2"))
{
// Set file details
SysFreeString(*sFileName);
*sFileName = SysAllocString(L"file2.txt");
*lUncompressedSizeLow = 4;
*bfaAttributes = bfaReadOnly;
*dtLastModified = VarToDateTime("2009-02-22 2:22:22 PM");
// Indicate that file details were provided
*bFileProvided = true;
}
// -------------------------------------------------
// Add this code to the RetrievingBuffer event
// handler of the BricolsoftZip1 control
// -------------------------------------------------
// Declare
HRESULT hr;
SAFEARRAY *psa;
SAFEARRAYBOUND safeBound[1];
char HUGEP *pChar;
// Check if this is the file we want to add
if (WideString(sFileName) == WideString("file1.txt"))
{
// Set file data - note that COM uses BSTR
// strings, hence this 4 character string takes
// 8 bytes of storage
vaData->vt = VT_BSTR;
vaData->bstrVal = SysAllocString(L"data");
// Indicate that file data was provided
*bEndOfData = VARIANT_TRUE;
}
else if (WideString(sFileName) == WideString("file2.txt"))
{
// Alternatively you can use character arrays to
// pass Ansi strings
// Set the bounds for first and only dimension
safeBound[0].cElements = 4;
safeBound[0].lLbound = 0;
// Allocate the SAFEARRAY
psa = SafeArrayCreate(VT_UI1,1,safeBound);
// Check result
if (psa != NULL)
{
// Get a pointer to the array data
hr = SafeArrayAccessData(psa, (void HUGEP* FAR*)&pChar);
// Check for success
if (SUCCEEDED(hr))
{
// Place elements into array
pChar[0] = 'd';
pChar[1] = 'a';
pChar[2] = 't';
pChar[3] = 'a';
// Release access
SafeArrayUnaccessData (psa);
// Set return variant fields
vaData->vt = (VT_ARRAY | VT_UI1);
vaData->parray = psa;
// Indicate that file data was provided
*bEndOfData = VARIANT_TRUE;
}
}
}
' --------------------------------------------------
' Add this code to a button's click event handler
' --------------------------------------------------
' Declare
Dim ErrorCode As bzError
' License - use your license key below if registered
BricolsoftZip1.License ("your license key")
' Initialize properties
BricolsoftZip1.ZipFileName = "C:\archive.zip"
BricolsoftZip1.FilesToProcess.Items = "*"
' Call the Unzip method
ErrorCode = BricolsoftZip1.Unzip
' Check the error code
If (ErrorCode <> berrSuccess) Then
MsgBox "Error during operation: " & BricolsoftZip1.GetDescription(bvtError, ErrorCode), vbOKOnly Or vbCritical, "Error"
Else
MsgBox "Operation completed successfully!", vbOKOnly Or vbInformation, "Info"
End If
' -------------------------------------------------
' Add this code to the UnzippingFile event
' handler of the BricolsoftZip1 control
' -------------------------------------------------
' Send all files to memory
bdmDestinationMedium = bdmMemory
' -------------------------------------------------
' Add this code to the ReturningBuffer event
' handler of the BricolsoftZip1 control
' -------------------------------------------------
' Declare
Dim sAsciiContents As String
Dim sCharCodes As String
Dim i As Long
' Loop over character codes from the returned data
For i = 0 To UBound(vaData)
' Add current character to ASCII character string
If vaData(i) = 0 Then
sAsciiContents = sAsciiContents & "."
Else
sAsciiContents = sAsciiContents & Chr(vaData(i))
End If
' Add current character to character code string
sCharCodes = sCharCodes & Format(Hex(vaData(i)), "00") & " "
Next i
' Trim codes string
sCharCodes = Left$(sCharCodes, Len(sCharCodes) - 1)
' Display the file contents
MsgBox "File contents of " & sFileName & ": " & vbNewLine & vbNewLine & "ASCII: " & sAsciiContents & vbNewLine & "Char Codes (Hex): " & sCharCodes
// --------------------------------------------------
// Add this code to a button's click event handler
// --------------------------------------------------
// Declare
bzError errorCode;
// License - use your license key below if registered
m_BricolsoftZip1.License(_T("your license key"));
// Initialize properties
m_BricolsoftZip1.put_ZipFileName(_T("C:\\archive.zip"));
m_BricolsoftZip1.get_FilesToProcess().put_Items(_T("*"));
// Call the Unzip method
errorCode = m_BricolsoftZip1.Unzip();
// Check the error code
if (errorCode != berrSuccess)
{
MessageBox(CString("Error during operation: ") + CString(m_BricolsoftZip1.GetDescription(bvtError, errorCode)), _T("Error"), MB_OK | MB_ICONERROR);
}
else
{
MessageBox(CString("Operation completed successfully!"), _T("Info"), MB_OK | MB_ICONINFORMATION);
}
// -------------------------------------------------
// Add this code to the UnzippingFile event
// handler of the BricolsoftZip1 control
// -------------------------------------------------
// Send all files to memory
*bdmDestinationMedium = bdmMemory;
// -------------------------------------------------
// Add this code to the ReturningBuffer event
// handler of the BricolsoftZip1 control
// -------------------------------------------------
// Declare
CString sAsciiContents;
CString sCharCodes;
CString sTemp;
char aBuffer[2];
unsigned long ulNumElements;
long aIndices[2];
// Initialize
ulNumElements = vaData->parray->rgsabound[0].cElements;
aBuffer[0] = aBuffer[1] = 0;
aIndices[0] = aIndices[1] = 0;
// Loop over each element
for (unsigned long i = 0; i< ulNumElements; i++)
{
// Set element index
aIndices[0] = i;
// Get the element data
SafeArrayGetElement(vaData->parray, aIndices, (void *)&aBuffer);
// Add the buffer contents to the ASCII string
if (aBuffer[0] == 0)
sAsciiContents += ".";
else
sAsciiContents += aBuffer;
// Translate character code to hex code
sTemp.Format(_T("%.2x"), aBuffer[0]);
// Add the buffer contents to the character codes
sCharCodes += sTemp;
sCharCodes += " ";
}
// Display the file contents
::MessageBox(NULL, CString("File contents of ") + sFileName + CString(": \n\nASCII: ") + sAsciiContents + CString("\nChar Codes (Hex): ") + sCharCodes, _T("Info"), MB_OK);
// --------------------------------------------------
// Add this code to a button's click event handler
// --------------------------------------------------
// Declare
BricolsoftZip.bzError errorCode;
// License - use your license key below if registered
BricolsoftZip1.License ("your license key");
// Initialize properties
BricolsoftZip1.ZipFileName = "C:\\archive.zip";
BricolsoftZip1.FilesToProcess.Items = "*";
// Call the Unzip method
errorCode = BricolsoftZip1.Unzip();
// Check the error code
if (errorCode != BricolsoftZip.bzError.berrSuccess)
{
MessageBox.Show("Error during operation: " + BricolsoftZip1.GetDescription(BricolsoftZip.bzValueType.bvtError, (System.Int32)errorCode), "Error",MessageBoxButtons.OK, MessageBoxIcon.Error);
}
else
{
MessageBox.Show("Operation completed successfully!", "Info",MessageBoxButtons.OK, MessageBoxIcon.Information );
}
// -------------------------------------------------
// Add this code to the UnzippingFile event
// handler of the BricolsoftZip1 control
// -------------------------------------------------
// Send all files to memory
e.bdmDestinationMedium = BricolsoftZip.bzDataMedium.bdmMemory;
// -------------------------------------------------
// Add this code to the ReturningBuffer event
// handler of the BricolsoftZip1 control
// -------------------------------------------------
// Declare
string AsciiContents;
string CharCodes;
byte[] Bytes;
// Transfer returned data to Bytes array
Bytes = (byte[])e.vaData;
// Create ASCII string from the returned data
AsciiContents = System.Text.Encoding.ASCII.GetString(Bytes);
// Create char codes string from the returned data
CharCodes = BitConverter.ToString(Bytes);
// Replace null characters with spaces in the ASCII string to avoid truncation during display
AsciiContents = AsciiContents.Replace(Convert.ToChar(0x0).ToString(), ".");
// Replace dash characters with spaces in the char codes string
CharCodes = CharCodes.Replace("-", " ");
// Display the file contents
MessageBox.Show("File contents of " + e.sFileName + ": \n\nASCII: " + AsciiContents + "\n" + "Char Codes (Hex): " + CharCodes, "Error", MessageBoxButtons.OK, MessageBoxIcon.Information);
' --------------------------------------------------
' Add this code to a button's click event handler
' --------------------------------------------------
' Declare
Dim errorCode As BricolsoftZip.bzError
' License - use your license key below if registered
BricolsoftZip1.License("your license key")
' Initialize properties
BricolsoftZip1.ZipFileName = "C:\archive.zip"
BricolsoftZip1.FilesToProcess.Items = "*"
' Call the Unzip method
errorCode = BricolsoftZip1.Unzip()
' Check the error code
If (errorCode <> BricolsoftZip.bzError.berrSuccess) Then
MessageBox.Show("Error during operation: " & BricolsoftZip1.GetDescription(BricolsoftZip.bzValueType.bvtError, errorCode), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
Else
MessageBox.Show("Operation completed successfully!", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information)
End If
' -------------------------------------------------
' Add this code to the UnzippingFile event
' handler of the BricolsoftZip1 control
' -------------------------------------------------
' Send all files to memory
e.bdmDestinationMedium = BricolsoftZip.bzDataMedium.bdmMemory
' -------------------------------------------------
' Add this code to the ReturningBuffer event
' handler of the BricolsoftZip1 control
' -------------------------------------------------
' Declare
Dim AsciiContents As String
Dim CharCodes As String
Dim Bytes() As Byte
' Transfer returned data to Bytes array
Bytes = e.vaData
' Create ACII string from the returned data
AsciiContents = System.Text.Encoding.ASCII.GetString(Bytes)
' Create char codes string from the returned data
CharCodes = BitConverter.ToString(Bytes)
' Replace null characters with spaces in the ASCII string to avoid truncation during display
AsciiContents = AsciiContents.Replace(Convert.ToChar(&H0).ToString(), ".")
' Replace dash characters with spaces in the char codes string
CharCodes = CharCodes.Replace("-", " ")
' Display the file contents
MessageBox.Show("File contents of " & e.sFileName & ": " & vbNewLine & vbNewLine & "ASCII: " & AsciiContents & vbNewLine & "Char Codes (Hex): " & CharCodes, "Error", MessageBoxButtons.OK, MessageBoxIcon.Information)
// --------------------------------------------------
// Add this code to a button's click event handler
// --------------------------------------------------
// Declare
bzError errorCode;
// License - use your license key below if registered
m_BricolsoftZip1.License(_T("your license key"));
// Initialize properties
m_BricolsoftZip1.put_ZipFileName(_T("C:\\archive.zip"));
m_BricolsoftZip1.get_FilesToProcess().put_Items(_T("*"));
// Call the Unzip method
errorCode = m_BricolsoftZip1.Unzip();
// Check the error code
if (errorCode != berrSuccess)
{
MessageBox(CString("Error during operation: ") + CString(m_BricolsoftZip1.GetDescription(bvtError, errorCode)), _T("Error"), MB_OK | MB_ICONERROR);
}
else
{
MessageBox(CString("Operation completed successfully!"), _T("Info"), MB_OK | MB_ICONINFORMATION);
}
// -------------------------------------------------
// Add this code to the UnzippingFile event
// handler of the BricolsoftZip1 control
// -------------------------------------------------
// Send all files to memory
*bdmDestinationMedium = bdmMemory;
// -------------------------------------------------
// Add this code to the ReturningBuffer event
// handler of the BricolsoftZip1 control
// -------------------------------------------------
// Declare
CString sAsciiContents;
CString sCharCodes;
CString sTemp;
char aBuffer[2];
unsigned long ulNumElements;
long aIndices[2];
// Initialize
ulNumElements = vaData->parray->rgsabound[0].cElements;
aBuffer[0] = aBuffer[1] = 0;
aIndices[0] = aIndices[1] = 0;
// Loop over each element
for (unsigned long i = 0; i< ulNumElements; i++)
{
// Set element index
aIndices[0] = i;
// Get the element data
SafeArrayGetElement(vaData->parray, aIndices, (void *)&aBuffer);
// Add the buffer contents to the ASCII string
if (aBuffer[0] == 0)
sAsciiContents += ".";
else
sAsciiContents += aBuffer;
// Translate character code to hex code
sTemp.Format(_T("%.2x"), aBuffer[0]);
// Add the buffer contents to the character codes
sCharCodes += sTemp;
sCharCodes += " ";
}
// Display the file contents
::MessageBox(NULL, CString("File contents of ") + sFileName + CString(": \n\nASCII: ") + sAsciiContents + CString("\nChar Codes (Hex): ") + sCharCodes, _T("Info"), MB_OK);
// --------------------------------------------------
// Add this code to a button's click event handler
// --------------------------------------------------
var
// Declare
errorCode: bzError;
begin
// License - use your license key below if registered
BricolsoftZip1.License ('your license key');
// Initialize properties
BricolsoftZip1.ZipFileName := 'C:\archive.zip';
BricolsoftZip1.FilesToProcess.Items := '*';
// Call the Unzip method
errorCode := BricolsoftZip1.Unzip();
// Check the error code
if (errorCode <> berrSuccess) then begin
MessageDlg('Error during operation: ' + String(BricolsoftZip1.GetDescription(bvtError, errorCode)), mtError, [mbOK], 0);
end else begin
MessageDlg('Operation completed successfully!', mtInformation, [mbOK], 0);
end;
end;
// -------------------------------------------------
// Add this code to the UnzippingFile event
// handler of the BricolsoftZip1 control
// -------------------------------------------------
begin
// Send all files to memory
bdmDestinationMedium := bdmMemory;
end;
// -------------------------------------------------
// Add this code to the ReturningBuffer event
// handler of the BricolsoftZip1 control
// -------------------------------------------------
var
// Declare
sAsciiContents: AnsiString;
sCharCodes: AnsiString;
nNumElements: LongWord;
aIndices: array [0..2] of LongWord;
chTempByte: Char;
i: LongWord;
begin
// Initialize
nNumElements := TVariantArg(vaData).parray.rgsabound[0].cElements;
aIndices[1] := 0;
// Loop over each element
for i := 0 to (nNumElements -1) do
begin
// Set element index
aIndices[0] := i;
// Get the element data
SafeArrayGetElement(TVariantArg(vaData).parray, aIndices, chTempByte);
// Add the buffer contents to the ASCII string
if (chTempByte = chr(0)) then begin
sAsciiContents := sAsciiContents + '.';
end else begin
sAsciiContents := sAsciiContents + chTempByte;
end;
// Add the buffer contents to the character codes
sCharCodes := sCharCodes + IntToHex(Integer(chTempByte), 2) + ' ';
end;
// Display the file contents
MessageDlg('File contents of ' + sFileName + ':'#13#10#13#10'ASCII: ' + sAsciiContents + #13#10'Char Codes (Hex): ' + sCharCodes, mtInformation, [mbOK], 0);
end;
// -------------------------------------------------
// Locate the uses statement for the unit containing
// the RetrievingBuffer event handler and add
// 'ActiveX' to the statement (see sample uses
// statement with 'ActiveX' added below)
// -------------------------------------------------
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, OleCtrls, ActiveX, BricolsoftZip_TLB;
// --------------------------------------------------
// Add this code to a button's click event handler
// --------------------------------------------------
// Declare
bzError errorCode;
// License - use your license key below if registered
BricolsoftZip1->License(WideString("your license key"));
// Initialize properties
BricolsoftZip1->ZipFileName = "C:\\archive.zip";
BricolsoftZip1->FilesToProcess->set_Items(L"*");
// Call the Unzip method
errorCode = BricolsoftZip1->Unzip();
// Check the error code
if (errorCode != berrSuccess)
{
MessageDlg("Error during operation: " + AnsiString(BricolsoftZip1->GetDescription(bvtError, errorCode)), mtError, TMsgDlgButtons() << mbOK, 0);
}
else
{
MessageDlg("Operation completed successfully!", mtInformation, TMsgDlgButtons() << mbOK, 0);
}
// -------------------------------------------------
// Add this code to the UnzippingFile event
// handler of the BricolsoftZip1 control
// -------------------------------------------------
// Send all files to memory
*bdmDestinationMedium = bdmMemory;
// -------------------------------------------------
// Add this code to the ReturningBuffer event
// handler of the BricolsoftZip1 control
// -------------------------------------------------
// Declare
AnsiString sAsciiContents;
AnsiString sCharCodes;
char chTempChar;
unsigned long ulNumElements;
long aIndices[2];
// Initialize
ulNumElements = vaData->parray->rgsabound[0].cElements;
aIndices[0] = aIndices[1] = 0;
// Loop over each element
for (unsigned long i = 0; i< ulNumElements; i++)
{
// Set element index
aIndices[0] = i;
// Get the element data
SafeArrayGetElement(vaData->parray, aIndices, &chTempChar);
// Add the buffer contents to the ASCII string
if (chTempChar == 0)
sAsciiContents += ".";
else
sAsciiContents += chTempChar;
// Add the buffer contents to the character codes
sCharCodes += String::IntToHex((int)chTempChar, 2) + " ";
}
// Display the file contents
MessageDlg(AnsiString("File contents of ") + sFileName + AnsiString(": \n\nASCII: ") + sAsciiContents + AnsiString("\nChar Codes (Hex): ") + sCharCodes, mtInformation, TMsgDlgButtons() << mbOK, 0);
Testing Example
This is a basic testing example. To delve deeper, please see the testing an archive quick start and the TestZip method help topic.
' Declare
Dim ErrorCode As bzError
' License - use your license key below if registered
BricolsoftZip1.License ("your license key")
' Initialize properties
BricolsoftZip1.ZipFileName = "C:\archive.zip"
' Call the TestZip method
ErrorCode = BricolsoftZip1.TestZip
' Check the error code
If (ErrorCode <> berrSuccess) Then
MsgBox "Error during operation: " & BricolsoftZip1.GetDescription(bvtError, ErrorCode), vbOKOnly Or vbCritical, "Error"
Else
MsgBox "Operation completed successfully!", vbOKOnly Or vbInformation, "Info"
End If
// Declare
bzError errorCode;
// License - use your license key below if registered
m_BricolsoftZip1.License(_T("your license key"));
// Initialize properties
m_BricolsoftZip1.put_ZipFileName(_T("C:\\archive.zip"));
// Call the TestZip method
errorCode = m_BricolsoftZip1.TestZip();
// Check the error code
if (errorCode != berrSuccess)
{
MessageBox(CString("Error during operation: ") + CString(m_BricolsoftZip1.GetDescription(bvtError, errorCode)), _T("Error"), MB_OK | MB_ICONERROR);
}
else
{
MessageBox(CString("Operation completed successfully!"), _T("Info"), MB_OK | MB_ICONINFORMATION);
}
// Declare
BricolsoftZip.bzError errorCode;
// License - use your license key below if registered
BricolsoftZip1.License ("your license key");
// Initialize properties
BricolsoftZip1.ZipFileName = "C:\\archive.zip";
// Call the TestZip method
errorCode = BricolsoftZip1.TestZip();
// Check the error code
if (errorCode != BricolsoftZip.bzError.berrSuccess)
{
MessageBox.Show("Error during operation: " + BricolsoftZip1.GetDescription(BricolsoftZip.bzValueType.bvtError, (System.Int32)errorCode), "Error",MessageBoxButtons.OK, MessageBoxIcon.Error);
}
else
{
MessageBox.Show("Operation completed successfully!", "Info",MessageBoxButtons.OK, MessageBoxIcon.Information );
}
' Declare
Dim errorCode As BricolsoftZip.bzError
' License - use your license key below if registered
BricolsoftZip1.License("your license key")
' Initialize properties
BricolsoftZip1.ZipFileName = "C:\archive.zip"
' Call the TestZip method
errorCode = BricolsoftZip1.TestZip()
' Check the error code
If (errorCode <> BricolsoftZip.bzError.berrSuccess) Then
MessageBox.Show("Error during operation: " & BricolsoftZip1.GetDescription(BricolsoftZip.bzValueType.bvtError, errorCode), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
Else
MessageBox.Show("Operation completed successfully!", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information)
End If
// Declare
bzError errorCode;
// License - use your license key below if registered
m_BricolsoftZip1.License(_T("your license key"));
// Initialize properties
m_BricolsoftZip1.put_ZipFileName(_T("C:\\archive.zip"));
// Call the TestZip method
errorCode = m_BricolsoftZip1.TestZip();
// Check the error code
if (errorCode != berrSuccess)
{
MessageBox(CString("Error during operation: ") + CString(m_BricolsoftZip1.GetDescription(bvtError, errorCode)), _T("Error"), MB_OK | MB_ICONERROR);
}
else
{
MessageBox(CString("Operation completed successfully!"), _T("Info"), MB_OK | MB_ICONINFORMATION);
}
var
// Declare
errorCode: bzError;
begin
// License - use your license key below if registered
BricolsoftZip1.License ('your license key');
// Initialize properties
BricolsoftZip1.ZipFileName := 'C:\archive.zip';
// Call the TestZip method
errorCode := BricolsoftZip1.TestZip(true);
// Check the error code
if (errorCode <> berrSuccess) then begin
MessageDlg('Error during operation: ' + String(BricolsoftZip1.GetDescription(bvtError, errorCode)), mtError, [mbOK], 0);
end else begin
MessageDlg('Operation completed successfully!', mtInformation, [mbOK], 0);
end;
end;
// Declare
bzError errorCode;
VARIANT bCheckCompressedData;
// License - use your license key below if registered
BricolsoftZip1->License(WideString("your license key"));
// Initialize variables and properties
BricolsoftZip1->ZipFileName = "C:\\archive.zip";
bCheckCompressedData.vt = VT_BOOL;
bCheckCompressedData.boolVal = VARIANT_TRUE;
// Call the TestZip method
errorCode = BricolsoftZip1->TestZip(bCheckCompressedData);
// Check the error code
if (errorCode != berrSuccess)
{
MessageDlg("Error during operation: " + AnsiString(BricolsoftZip1->GetDescription(bvtError, errorCode)), mtError, TMsgDlgButtons() << mbOK, 0);
}
else
{
MessageDlg("Operation completed successfully!", mtInformation, TMsgDlgButtons() << mbOK, 0);
}
' Declare
Dim ErrorCode As bzError
' License - use your license key below if registered
BricolsoftZip1.License ("your license key")
' Initialize properties
BricolsoftZip1.ZipFileName = "C:\archive.zip"
BricolsoftZip1.OutputFileName = "C:\archive2.zip"
' Call the RepairZip method
ErrorCode = BricolsoftZip1.RepairZip
' Check the error code and display any errors
If (ErrorCode <> berrSuccess) Then
MsgBox "Error during operation: " & BricolsoftZip1.GetDescription(bvtError, ErrorCode), vbOKOnly Or vbCritical, "Error"
Else
MsgBox "Operation completed successfully!", vbOKOnly Or vbInformation, "Info"
End If
// Declare
bzError errorCode;
// License - use your license key below if registered
m_BricolsoftZip1.License(_T("your license key"));
// Initialize properties
m_BricolsoftZip1.put_ZipFileName(_T("C:\\archive.zip"));
m_BricolsoftZip1.put_OutputFileName(_T("C:\\archive2.zip"));
// Call the RepairZip method
errorCode = m_BricolsoftZip1.RepairZip();
// Check the error code
if (errorCode != berrSuccess)
{
MessageBox(CString("Error during operation: ") + CString(m_BricolsoftZip1.GetDescription(bvtError, errorCode)), _T("Error"), MB_OK | MB_ICONERROR);
}
else
{
MessageBox(CString("Operation completed successfully!"), _T("Info"), MB_OK | MB_ICONINFORMATION);
}
// Declare
BricolsoftZip.bzError errorCode;
// License - use your license key below if registered
BricolsoftZip1.License ("your license key");
// Initialize properties
BricolsoftZip1.ZipFileName = "C:\\archive.zip";
BricolsoftZip1.OutputFileName = "C:\\archive2.zip";
// Call the RepairZip method
errorCode = BricolsoftZip1.RepairZip();
// Check the error code
if (errorCode != BricolsoftZip.bzError.berrSuccess)
{
MessageBox.Show("Error during operation: " + BricolsoftZip1.GetDescription(BricolsoftZip.bzValueType.bvtError, (System.Int32)errorCode), "Error",MessageBoxButtons.OK, MessageBoxIcon.Error);
}
else
{
MessageBox.Show("Operation completed successfully!", "Info",MessageBoxButtons.OK, MessageBoxIcon.Information );
}
' Declare
Dim errorCode As BricolsoftZip.bzError
' License - use your license key below if registered
BricolsoftZip1.License("your license key")
' Initialize properties
BricolsoftZip1.ZipFileName = "C:\archive.zip"
BricolsoftZip1.OutputFileName = "C:\archive2.zip"
' Call the RepairZip method
errorCode = BricolsoftZip1.RepairZip()
' Check the error code
If (errorCode <> BricolsoftZip.bzError.berrSuccess) Then
MessageBox.Show("Error during operation: " & BricolsoftZip1.GetDescription(BricolsoftZip.bzValueType.bvtError, errorCode), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
Else
MessageBox.Show("Operation completed successfully!", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information)
End If
// Declare
bzError errorCode;
// License - use your license key below if registered
m_BricolsoftZip1.License(_T("your license key"));
// Initialize properties
m_BricolsoftZip1.put_ZipFileName(_T("C:\\archive.zip"));
m_BricolsoftZip1.put_OutputFileName(_T("C:\\archive2.zip"));
// Call the RepairZip method
errorCode = m_BricolsoftZip1.RepairZip();
// Check the error code
if (errorCode != berrSuccess)
{
MessageBox(CString("Error during operation: ") + CString(m_BricolsoftZip1.GetDescription(bvtError, errorCode)), _T("Error"), MB_OK | MB_ICONERROR);
}
else
{
MessageBox(CString("Operation completed successfully!"), _T("Info"), MB_OK | MB_ICONINFORMATION);
}
var
// Declare
errorCode: bzError;
begin
// License - use your license key below if registered
BricolsoftZip1.License ('your license key');
// Initialize properties
BricolsoftZip1.ZipFileName := 'C:\archive.zip';
BricolsoftZip1.OutputFileName := 'C:\archive2.zip';
// Call the RepairZip method
errorCode := BricolsoftZip1.RepairZip();
// Check the error code
if (errorCode <> berrSuccess) then begin
MessageDlg('Error during operation: ' + String(BricolsoftZip1.GetDescription(bvtError, errorCode)), mtError, [mbOK], 0);
end else begin
MessageDlg('Operation completed successfully!', mtInformation, [mbOK], 0);
end;
end;
// Declare
bzError errorCode;
// License - use your license key below if registered
BricolsoftZip1->License(WideString("your license key"));
// Initialize properties
BricolsoftZip1->ZipFileName = "C:\\archive.zip";
BricolsoftZip1->OutputFileName = "C:\\archive2.zip";
// Call the RepairZip method
errorCode = BricolsoftZip1->RepairZip();
// Check the error code
if (errorCode != berrSuccess)
{
MessageDlg("Error during operation: " + AnsiString(BricolsoftZip1->GetDescription(bvtError, errorCode)), mtError, TMsgDlgButtons() << mbOK, 0);
}
else
{
MessageDlg("Operation completed successfully!", mtInformation, TMsgDlgButtons() << mbOK, 0);
}