Search Tools Links Login

String, array and file compression with Zlib.dll

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.

Original Author: Doug Gaede

About this post

Posted: 2002-06-01
By: ArchiveBot
Viewed: 96 times


Visual Basic 6

Posted: 9/3/2020 3:45:00 PM
Size: 53,412 bytes

Loading Comments ...


No comments have been added for this post.

You must be logged in to make a comment.