Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

How to test from VB if a zip file password is correct?

Posted on 2005-04-12
7
Medium Priority
?
291 Views
Last Modified: 2008-02-01
I need to test from VB if an especific word is the correct password for a zip file... How can I do this?
0
Comment
Question by:wcoka
  • 3
  • 2
5 Comments
 
LVL 9

Expert Comment

by:Dang123
ID: 13766952
wcoka,
    This may be what your looking for

Unzipping files using the free Info-Zip Unzip DLL with VB
http://vbaccelerator.com/codelib/zip/unzip.htm

Dang123
0
 

Author Comment

by:wcoka
ID: 13775197
I did what it says, I add the 2 files
cUnzip.cls
mUnzip.bas

Then add this line in the form
 Private WithEvents m_cUnzip As cUnzip

and with a command I put this code
   m_cUnzip.ZipFile = sFIle

   ' Set the base folder to unzip to:
   m_cUnzip.UnzipFolder = sFolder

   ' Unzip the file!
   m_cUnzip.Unzip

But I get error 91

Can you try to do this? or recommend me other way to do this?
Can it be because I'm using XP?
0
 
LVL 9

Accepted Solution

by:
Dang123 earned 2000 total points
ID: 13775844
wcoka,
    Have you tried the sample project?
    I think this should work for you.
Dang123


Option Explicit

Private WithEvents m_cUnzip As cUnzip

Private Sub Dir1_Change()
    File1.Path = Dir1.Path
End Sub

Private Sub Drive1_Change()
    Dir1.Path = Drive1.Drive
End Sub

Private Sub File1_Click()
    m_Combo.SetCharacterSet Text1.Text
   
    m_cUnzip.ZipFile = File1.Path & "\" & File1.Filename
    m_cUnzip.UnzipFolder = File1.Path
    m_cUnzip.Unzip
End Sub

Private Sub Form_Load()
    Drive1.Drive = Left$(App.Path, 1)
    Dir1.Path = App.Path
    File1.Pattern = "*.zip"
   
    m_blnMissed = False
   
    Set m_cUnzip = New cUnzip
End Sub

Private Sub Form_Unload(Cancel As Integer)
    Set m_cUnzip = Nothing
    Set m_Combo = Nothing
End Sub

Private Sub m_cUnzip_PasswordRequest(sPassword As String, bCancel As Boolean)
   sPassword = "ThePassword"
End Sub

Private Sub m_cUnzip_Progress(ByVal lCount As Long, ByVal sMsg As String)
    List1.AddItem lCount & sMsg
End Sub
0
 

Author Comment

by:wcoka
ID: 13776171
The problem is that if the first time you send the incorrect password the something happend that even if later you send it correctly you still get the error of incorrect password... Please try it send an incorrect password then try with the correct one

Thanks
0
 
LVL 9

Expert Comment

by:Dang123
ID: 13917756
wcoka,
    Sorry for the delay in responding, I got VERY busy.

    The dll seems to have someting in it to skip a file if you give three bad passwords, I think you need to close the zip and reopen it after three failed attempts.

Dang123
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses
Course of the Month20 days, 17 hours left to enroll

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question