PowerBuilder
PowerBuilder
Verify a Zip's Password
See more Zip Examples
Demonstrates how to verify the password for an encrypted or password-protected zip archive.Chilkat PowerBuilder Downloads
integer li_rc
integer li_Success
oleobject loo_Zip
integer li_PasswordOk
li_Success = 0
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
loo_Zip = create oleobject
li_rc = loo_Zip.ConnectToNewObject("Chilkat.Zip")
if li_rc < 0 then
destroy loo_Zip
MessageBox("Error","Connecting to COM object failed")
return
end if
// To verify a password for a Zip, the Zip must be opened:
li_Success = loo_Zip.OpenZip("myProtected.zip")
if li_Success <> 1 then
Write-Debug loo_Zip.LastErrorText
destroy loo_Zip
return
end if
// Set the password to be verified:
loo_Zip.DecryptPassword = "secret"
li_PasswordOk = loo_Zip.VerifyPassword()
if li_PasswordOk = 1 then
Write-Debug "Password is correct."
else
Write-Debug "Password is incorrect."
end if
loo_Zip.CloseZip()
destroy loo_Zip