The DOCUMENT.PRG program maintains a database file containing compressed documents. It packs a file and inserts the compressed file in a memo field. It also decompresses memo fields. This program makes use of the edilzssa.dll compression library (DLL) for Windows. The edilzssa.dll library contains functions that perform file-to-file compress and decompress operations. This library is a shareware program provided by:
Eschalon Development Inc
110-2 Renaissance Square
New Westminster, BC, V3M 6K3 Canada,
Tel: (604) 520-1543)
As for all shareware software, If you find this library useful, you can send a check to the vender to register the software and in appreciation, the developer will send you an improved version of the DLL library.
The edilzssa.dll library uses an enhanced form of the LZSS compression algorithm. The LZSS algorithm is an improved variant of the dictionary-based compression LZ77 algorithm developed by Jacob Ziv and Abraham Lempel.
This DLL library was created for general use and can only be accessed within FoxPro 2.5 for Windows using the FOXTOOLS.FLL library. The library consists of two functions: LZSSPackFile() compresses a file and LZSSUnPackFile() decompresses a file.
The DOCUMENT.PRG maintains the DOCUMENT.DBF database which contains a memo field and various document description fields. The structure of DOCUMENT.DBF is
Structure for table: c:\foxprow\book\document.dbf
Number of data records: 5
Date of last update: 01/13/93
Memo file block size: 64
Field Field Name Type Width Dec
1 TITLE Character 40
2 DATE Date 8
3 KEYWORDS Character 50
4 FILENAME Character 40
5 DOCUMENT Memo 10
** Total ** 149
When DOCUMENT.PRG executes, it displays a dialog box (See Figure 21.1 in the Book) which allows you to edit fields in the database file. The form also contains push buttons that you can use designate which database maintenance operation you want to perform. The screen program, DOCUMENT.SPR, as presented in Listing 21.5, controls the display of the form. It was created using the FoxPro 2.5 for Windows Screen Builder.
The push buttons in the document dialog box perform the following operations:
Next Move to the next record
Previous Move to the previous record
Top Move to the first record in the database
Bottom Move to the last record in the database
Add Add a new record. An Open File dialog box appears. You choose a file. The file is compressed using the LZSSPackFile() function and placed in the memo field of the new record. The current date is used. Finally, you can edit the new record and add descriptive data.
UnPack The DOCUMENT memo field for the current record is transferred to a temporary file (crunch.tmp) LZSSUnPackFile() is called to decompress file crunch.tmp file and write the decompressed document into the file designated by filename field for the current record.
View The DOCUMENT memo field is decompressed (Like UnPack button) into file VIEW.TMP. Then VIEW.TMP displays in an edit window.
Exit Program DOCUMENT exits.
The LZSSPackFile() and LZSSUnPackFile() library functions are called using functions in the FOXTOOLS.FLL library. The RegFn() function is called to register either Function. Since the function has two arguments, the ArgTypes string will have a value of "CC". Both functions return an integer error code. Therefore, the ReturnType argument is assigned a value of "I". Finally, You will assign "edilzssa.dll" to the DLLName string.
When either of the edilzssa.dll library functions are called and have successfully performed their duty, an irritating dialog box appears that reminds you to register the shareware by sending money to the vendor. The aggravating dialog box does not appear in the registered version.