Alchemy Lab
Alchemy of Windows Software
  Main page | Alchemy DBF Access | CInfoZip MFC Class | CRAS MFC Class  


CInfoZip is an MFC class, wrapping functionality of InfoZip, a great and powerfull free ZIP/UnZIP libraries. CInfoZip was designed to bring compression power to AutoMail, a small handy application, that will help you sending files by e-mail directly from Windows Explorer context menu or from DOS command prompt. CInfoZip does not perform compression itself, it provides easy-to-use interface to InfoZip DLLs (included in CInfoZip package).

Add CInfoZip files to your project
Add CInfoZip files to your project and place ZIPDLL.DLL and UNZDLL.DLL files into your EXE working directory (\DEBUG\ or \RELEASE\). You may use only one of these DLLs if you need to support compression or decompression only.

Create CInfoZip class instance
Within your code create CInfoZip class and add initialization method calls:
BOOL CInfoZip::InitializeZip();
BOOL CInfoZip::InitializeUnzip();
BOOL CInfoZip::Initialize();

The first two functions load InfoZip DLLs, retrieve pointers to their procedures they will be using, and return TRUE if all necessary data was successfully retrieved and FALSE otherwise. The last one initializes both ZIP and UnZIP DLLs.

Add/extract files
To add/extract files to/from archive please call:
BOOL CInfoZip::AddFiles(const char *pszArchive, char **paFiles, int iFileCount);
BOOL CInfoZip::ExtractFiles(const char *pszArchive, const char * pszTargetFolder);

where pszArchive is a NULL-terminated string, containing full path and name of the archive file, paFiles - array of NULL-terminated strings containing file names with full path, iFileCount is a number of files in paFiles array and pszTargetFolder is a full path of the folder extracted files will be placed in.

Change ZIP parameters
When using these methods compression and extraction are performed with some predefined parameters set in:
BOOL CInfoZip::SetDefaultValues(CZipParams *pParams);
BOOL CInfoZip::SetDefaultValues(CUnzipParams *pParams);

If you need to perform ZIP operations with different parameters, you should create a structure of type CZipParams/CUnzipParams, fill it with your values (or call SetDefaultParams and then change some structure members) and then call CInfoZip::Execute method:
BOOL CInfoZip::Execute(CZipParams *pParams);
BOOL CInfoZip::Execute(CUnzipParams *pParams);

Finishing working with CInfoZip
After you've finished working with CInfoZip, release allocated resources and loaded DLLs by calling:
BOOL CInfoZip::FinalizeZip();
BOOL CInfoZip::FinalizeUnzip();
BOOL CInfoZip::Finalize();

We've got more great code for you! Check our Alchemy DBF Access - the smart library for any development tool that brings full database access for your programs and just few kilobytes to your executable!
Alchemy DBF Access
Download CInfoZip source code

Get more great code!
Alchemy DBF Access
CInfoZip MFC class
CRAS MFC class
Subscribe to news
Copyright (c) Alchemy Lab, 1999-2000