(Visual FoxPro) Verify a Zip's Password
Demonstrates how to verify the password for an encrypted or password-protected zip archive.
LOCAL loZip
LOCAL lnSuccess
LOCAL lnPasswordOk
* This example requires the Chilkat API to have been previously unlocked.
* See Global Unlock Sample for sample code.
* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.Zip')
loZip = CreateObject('Chilkat.Zip')
* To verify a password for a Zip, the Zip must be opened:
lnSuccess = loZip.OpenZip("myProtected.zip")
IF (lnSuccess <> 1) THEN
? loZip.LastErrorText
RELEASE loZip
CANCEL
ENDIF
* Set the password to be verified:
loZip.DecryptPassword = "secret"
lnPasswordOk = loZip.VerifyPassword()
IF (lnPasswordOk = 1) THEN
? "Password is correct."
ELSE
? "Password is incorrect."
ENDIF
loZip.CloseZip()
RELEASE loZip
|