Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Dynazip
Message
De
15/12/2003 13:07:42
 
 
À
15/12/2003 11:40:23
Jim Rieck
Quicken Loans/Rock Financial/Title Sourc
Livonia, Michigan, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Produits tierce partie
Titre:
Divers
Thread ID:
00858794
Message ID:
00859198
Vues:
20
>Thanks for the answers. Would I just set the EncryptFlag to true and the EncryptCode to the password that I want and then zip the files? Do you have/know of any sample code I could follow?

Something like this:
Local lcFileList, lcItemList, lcZipFileComment, llError, lcZIPFileName
Local loZip As dzactxctrl.dzactxctrl.1
lcFileList = ""
lcZIPFileName = "BackData.Zip"

* instantiate a DynaZip object to zip files
Try
  loZip = Createobject("dzactxctrl.dzactxctrl.1")
  llError = .F.

Catch To oErr
  * could not instantiate DynaZIP library
  * most probable Errno: 1733 - "Class definition <name> is not found"
  loZip = .Null.
  llError = .T.
  * do whatever
Endtry

If llError
  Return .F.
Endif

lcFileList = This.cDataFolder + "Delta*.DBF"
lcFileList = lcFileList + " " + This.cDataFolder + "Merter*.XML"

* use DynaZip ActiveX
With loZip
  .ActionDZ = ZIP_NOACTION    && turn off
  .ZipFile = Alltrim(This.cFolder + lcZIPFileName)
  .EncryptCode = "testpwd"
  .EncryptFlag = .T.

  * file(s) or list of items to ZIP (make sure it has full path)
  .ItemList = Alltrim(lcFileList)

  .NoDirectoryNamesFlag = .T.    && don't add path to ZIP files
  .ActionDZ = ZIP_ADD        && executes
  .ActionDZ = ZIP_NOACTION    && turn off

  If .ErrorCode = ZE_OK
    * all's well.
  Else
    * error creating ZIP file
    lcMessage = "Error creating ZIP file!"
    * I log error here and send email to SysAdmin
    Messagebox(lcMessage, MB_ICONSTOP, "ZIP Error")
  Endif
Endwith


Alex Feldstein, MCP, Microsoft MVP
VFP Tips: English - Spanish
Website - Blog - Photo Gallery


"Once again, we come to the Holiday Season, a deeply religious time that each of us observes, in his own way, by going to the mall of his choice." -- Dave Barry
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform