VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



String, array and file compression with Zlib.dll

by Doug Gaede (7 Submissions)
Category: Encryption
Compatability: Visual Basic 3.0
Difficulty: Intermediate
Date Added: Wed 3rd February 2021
Rating: (8 Votes)

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 vbcoders.com 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.

Rate String, array and file compression with Zlib.dll

Download String, array and file compression with Zlib.dll

Download String, array and file compression with Zlib.dll (51 KB)

String, array and file compression with Zlib.dll Comments

No comments have been posted about String, array and file compression with Zlib.dll. Why not be the first to post a comment about String, array and file compression with Zlib.dll.

Post your comment

Subject:
Message:
0/1000 characters