Post

 Resources 

Console

Using Zip Files In VB Part 1


Introduction



This is part 1 of a 3 part series of tutorials that will allow you to use zip files in a VB program.  Part 1 demonstrates how to create a VB compatible DLL with Visual C++ 6.0.  Part 2 demonstrates how to create a VB interface for accessing the DLL.  Part 3 of the series shows how to use the C DLL and VB code to create a simple virtual file system for keeping track of game content.

Requirements

To complete this part of the tutorial you'll need Visual C++ 6.0. You can compile this DLL with other versions of C or other versions of Visual C++, but this tutorial is specific to VC++6.0.  Other versions of VC++ are similar, so this can still be used as a guide line for creating your own DLLs.

Optionally, if you don't have a C++ compiler you can skip to part 2 or part 3 of the tutorial and use the compiled DLL  provided in those sections.

Source Code

You can download the source code that accompanies this tutorial by clicking on the following link: Download VBZip1.zip.This file includes version 1.22 of zlib which is the latest version of the source at the time of this writing.  Depending on when you're reading this, there may be an updated version of the source code. The file also includes a working VC++ 6.0 project file that sucessfully compiles a working DLL.

History of .Zip

The zip file format has been around for a very long time.  It gained popularity among bulletin board systems (BBSes) of the late 80's and early 90's.  BBSes were one of the best ways to distribute software, especially games, in the early days of personal computers.  The ability to include multiple files in a single archive with compression made .zip files very usefull, they saved time in downloading files by being smaller and avoiding having to download many files individually. Since most files on the BBSes were in a .zip format, the original creators of the file format distributed a free tool to allow people to extract the files from the archive. That tool, pkunzip, was as widely used as zip files, since a zip file was useless without it.

When the .zip format was eventually released to the public, alternative programs were created that allowed the creation and viewing of zip files. The modern day zip file, despite its widespread and open nature, has become somewhat limited in modern programs.  The reason for this is that companies are now realeasing their own modified versions of zip files that are only compatible with their respective programs.  Since the creator of the .zip file format died, his former company is now in a format war with it's competitors. Because of this disagreement, a file created with one program may not work for some people.

Compatibility

Since the target audience of this tutorial is for people that make games, especially in terms of keeping a game's resources (graphics,sounds, scripts) compact and with some encryption a bit safer from casual theft, compatiblity with modern zip programs shouldn't be that much of a problem if you use this DLL for the creation of the zip files.  If you using a modern zip program to create and encrypte a zip file, then I doubt this DLL could read it.  Another limitation with this DLL is that a zip file is limited to 4GB in size with a maximum number of 65535 files.  These limitations are limitations of the original zip file format and of this DLL, some modern programs have changed the format slightly and can surpass these limitations.  Files created that are larger than 4GB in size or that have more than 65535 files will be incompatible with this DLL.



Next: Creating A New DLL | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8

2 comments

Tutorial Console

Tutorial by:

Eric Coleman


Date: 2005 May 23


Navigate



2 comments

Latest comment


by: TiCL

Is it possible to get the code for the later parts of this article?

Post a Comment


Printer Friendly



Copyright © 2002 - 2004 Eric Coleman, Peter Kuchnio , et. al.
There have been 61 visitors within the last 20 minutes
RSS News Feed