i want to zip and unzip files and folder trough vb but i dont know how to begin, i found that there is a dll called zipfldr but i've found nothing in the forum, if anyone know the syntax i will appreciate your help...
vbAccelerator has a freeware ZIP library, example included. Alternativaly, you can require your user to install WinZip and use the app via the command line.
What happens with vbaccelerator's suggestion. You can use Winzip to zip/unzip files using command line.... but you'd need the (registered version of) Winzip installed and the command-line add-in as well. Otherwise... the code won't work.
Emiliano F. Martín
If a post has helped you then pleaseRate it! (and give the user points he/she deserves by clicking on the image).
Encourage the person who helped you to keep doing it, and give him the points he deserves.
MP3 Organizer: Freeware to logically organize all your MP3s.
and before anything....i couln't register the olelib.tlb and olelib.odl because i dont have the regtlib.exe file ...but i added the reference by searching it...can that be the problem?
REGTLIB.EXE should be in your Windows directory. I'm using WinXP Pro SP1a. Adding a reference to olelib.tlb in VB (as you did) will also register the file, so that should be OK. But the ODL file also needs to be registered for the whole thing to work properly. I'd say that's why you're still getting errors.
If you can't find REGTLIB.EXE, I could probably email it to you. I guess it's just a standard OS file.
Pete
No trees were harmed in the making of this post, however a large number of electrons were greatly inconvenienced.
tanx for the file ... and im sure i didnt have it...but that doesnt matter know....i've registered the 3 files olelib.tlb olelb.odl and olelib2.tlb using start menu, run, regtlib "file" ...
that was the problem...now it works....thank you all for your time specially you pnish and buggy programmer you took pretty much time on this....i guess thats all
one last question....how do i extract the files if theres a password in the zip...cause if the txt file inside the zip has a password it just extract the file in blank i mean empty...
Originally posted by Undotgiven one last question....how do i extract the files if theres a password in the zip...cause if the txt file inside the zip has a password it just extract the file in blank i mean empty...
I'm not sure. Give me a few minutes and I'll see if I can figure it out.
Pete
No trees were harmed in the making of this post, however a large number of electrons were greatly inconvenienced.
ok it work only with 0,1 and 2 i've tested a lot of numbers but it only works with those i even tried negative numbers... but vb crashes ... and when i use that it doesnt unzip any files its just like entering the correct password and thats all it doesnt do anything else...
I found this on the vbAccelerator web site. I don't know if this is the same prog that TheVader & Mc Brain were talking about, but it appears to work OK (and I don't have WinZip on my PC).
Give it a go and see what you reckon
Without looking too closely, that file I posted appears to only ZIP files, not UNZIP.
Looks like you guys have zipping and unzipping down. But what if I just want to read the contents of the zip file and display the file names or store the file names in a database?
This is a single-class pure VB6 library for zip archives management with ASM speed (uses bytecode thunks) that supports the original ZipCrypto and the stronger AES encryption for password protected archives.
This is a single-class pure VB6 library for zip archives management with ASM speed (uses bytecode thunks) that supports the original ZipCrypto and the stronger AES encryption for password protected archives.
VERY interesting.
I tried the vbZip project, and it works flawless.
Like this:
Code:
vbzip -o "T:\ZIPTEST" x "T:\Desktop\bla.zip"
When I want to use your work in my projects, I only need to unzip a zip file to a folder.
I tried the basic project.
Code:
Private Sub Command4_Click()
Dim dblTimer As Double
Dim bResult As Boolean
Dim sLastError As String
dblTimer = Timer
Set m_oZip = New cZipArchive
m_bCancel = False
With m_oZip
.OpenArchive "T:\Desktop\bla.zip"
Set m_oExtractInMemory = m_oZip
bResult = .Extract("T:\ZIPTEST")
Set m_oExtractInMemory = Nothing
sLastError = .LastError
End With
Set m_oZip = Nothing
labProgress.Caption = IIf(bResult, "Done. ", sLastError & ". ") & Format(Timer - dblTimer, "0.000") & " elapsed"
End Sub
This doesn't create the folder to extract to.
And even when the folder exists, no extracted file comes in.
I thought the .Extract method would do this.
@Karl77: I'm sorry for the confusing sample you found but you don't need the lines that set m_oExtractInMemory to make it work. This particular sample shows how to intercept BeforeExtract event and (selectively) re-route target file of extraction to a memory stream, that's why there is nothing extracted on disk.
You can check out the samples in README in the repos home-page/root for a quick intro to class usage, for instance this simple one extracts all zipped files to a folder on disk:
This is a single-class pure VB6 library for zip archives management with ASM speed (uses bytecode thunks) that supports the original ZipCrypto and the stronger AES encryption for password protected archives.
Thank you! This is really an impressing piece of code!
However, it uses techniques which obviously make some AV vendors' alarm bells ring ... see this VirusTotal result with a test program I made.
So for now I had to switch back to Edanmo's CompressedFolder.cls. Nevertheless I'm busy now sending emails to those AV vendors asking for investigation of the issue. Let's see what happens ...
Too bad as I don't have any false positives when the class is part of a larger project.
I'll probably need to obfuscate it further to fool the AV vendors for 100% fool-proof solution. Something like bare LoadLibrary+GetProcAddress approach :-))
@Wolfgang Enzinger: Btw, just tested vbzip.exe (the command-line zip utility from projects test directory) and only machine-learning engines raise alerts on VirusTotal. Removing the call to VirtualAlloc reduced these to only one ML engine so (most probably) using the class is pretty safe in the wild.
Now, why your project raises so much false alarms is another topic but my point is that you might have troubles w/ AVs whichever zip impl is used, might be getting false alarms for totally unrelated to zip archives management reasons.
Now, why your project raises so much false alarms is another topic but my point is that you might have troubles w/ AVs whichever zip impl is used, might be getting false alarms for totally unrelated to zip archives management reasons.
That, or a combination of some things. My project is a console application using Karl E. Peterson's MConsole. That alone usually doesn't trigger any false alarms, but maybe in combination with other techniques it does, who knows.
Anyway, Avira meanwhile confirmed that this is a false positive.
Wolfgang
Last edited by Wolfgang Enzinger; May 1st, 2019 at 09:48 AM.
So for now I had to switch back to Edanmo's CompressedFolder.cls.
Since you're using the RC5, perhaps the "zipfile" virtual table binding would be another alternative for you...?
SQL = "Select * From zipfile('" & FileNameOnDisk & "')"
At work, we use (and "ship") it already (since a year or so), to deal with Office-Documents (*.xlsx, *.docx)
(for "user-template-based reporting").
Well, for this specific program I'll stay with Edanmo's CompressedFolder.cls because ... this is kind of an "admin tool", and those admins love to copy the EXEcutable file only to any folder and then complain that it doesn't work ... so this tool should have zero dependencies. But for other projects this will come in handy.