winzip icon

String, array and file compression with Zlib.dll

Submitted on: 1/10/2015 3:44:00 AM
By: Doug Gaede (from psc cd)  
Level: Intermediate
User Rating: By 8 Users
Compatibility: VB 6.0
Views: 1438
     This code has been upgraded in another post. Please look for 'Business-strength compression, encryption and signing (single and public/private keys via CryptoAPI)' on this site. This wrapper class and example program demonstrates the proper use of the Zlib compression dll. Unbelievably, Windows does not provide adequate string/file compression in the API (only decompression of files created with the compress.exe or compact.exe utilities that come with Windows, and their compression is weak by today's standards). No string or array compression support...and having to call an exe to compress a file is far from perfect. To fill this void a group wrote the Zlib.dll utility (included; their web site address is included, too, so you can get the latest version). They used the same code to produce the compression algorithms that are used by the newer PNG picture format. So if you have used PNG you have used Zlib. I have seen the Zlib dll used by several commercial programs, too. It provides fast and compact encryption for byte arrays. This wrapper class extends it to strings and full files, too. Two other postings on planetsourcecode deal with Zlib. One is barely functional and the other only provides the coverted C header files (but is otherwise excellent with many utilities and modules to do other things -- check out "Kira" posted by The_Lung). I found this code on the Zlib web site, and converted it from an ocx to a regular class module to conserve resources. I also moved all the code dealing with file compression into the class where it belonged.
winzip iconDownload code

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. Afterdownloading it, you will need a program like Winzip to decompress it.Virus note:All files are scanned once-a-day by Planet Source Code for viruses, but new viruses come out every day, so no prevention program can catch 100% of them. For your own safety, please:
  1. Re-scan downloaded files using your personal virus checker before using it.
  2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.
  3. Scan the source code with Minnow's Project Scanner

If you don't have a virus scanner, you can get one at many places on the net

Other 6 submission(s) by this author


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Intermediate category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)

Other User Comments

 There are no comments on this submission.

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)

To post feedback, first please login.