Chilkat HOME ASP Visual Basic VB.NET C# Visual C++ C MFC Delphi FoxPro Java Perl PHP Python Ruby SQL Server VBScript
|
Create a Password-Protected ZipDelphi example code showing how to create a password-protected Zip. // Delphi example code to create a password-protected zip. procedure TForm1.Button11Click(Sender: TObject); var recurse: Integer; success: Integer; begin // UnlockComponent should be called once at the beginning of a program. ChilkatZip21.UnlockComponent('anything for 30-day trial'); // Initialize the zip object. ChilkatZip21.NewZip('testPW.zip'); // Add a directory tree to the zip object. The AppendFiles // method recursively descends a directory and adds references to // files and directories to the zip object. When the // zip is written (by calling WriteZipAndClose) all referenced files // and directories are added. recurse := 1; ChilkatZip21.AppendFiles('c:/temp/abc/*', recurse); // The PasswordProtect property is entirely separate from the Encryption // property. Both should not be set to non-zero values at the same time. // Password protection is the older, less-secure method of encrypting zips. // ChilkatZip21.PasswordProtect := 1; // Don't forget to set a password. ChilkatZip21.SetPassword('myPassword'); success := ChilkatZip21.WriteZipAndClose(); if (success = 0) then begin ChilkatZip21.SaveLastError('zipErrorLog.txt'); ShowMessage(ChilkatZip21.LastErrorText); end; ShowMessage('Done!'); end;
|
Need a specific example? Send a request to support@chilkatsoft.com
© 2000-2008 Chilkat Software, Inc. All Rights Reserved.