Hi all. Just created this DLL which I thought might be useful to some of you looking for a way to distribute compressed files with your software and decompress them from within DarkBasic Pro. Its a tiny DLL (39kb) so adds very little to your final exe size. Here is most of the ReadMe file explaining what it does...
Zappo Decompression DLL for DarkBasic Pro
Description:
This is a simple DLL wrapper for the Windows built-in decompression
system. I am sure you will have seen lots of files ending with an
underscore on your Windows installation CD (e.g. file.ex_) and in
other install packages. These files are compressed using Microsofts
'compress.exe' command which by default uses a flavour of the LZX
compression algorithm. This DLL lets you decompress files from
inside your DarkBasic Pro programs.
Installation:
Copy the 'ZappoDecompress.dll' file to the 'plugins-user' folder of
your DarkBasic Pro installation, usually something like:
C: \Program Files\Dark Basic Professional\Compiler\plugins-user
Copy the 'keywords_zappodecompress.ini' file to the 'keywords'
folder of the DarkBasic Pro Editor directory, usually like:
C: \Program Files\Dark Basic Professional\Editor\Keywords
Run or restart your DarkBasic Pro IDE and give it a try!
Usage:
There is only one command which takes the form:
Zappo Decompress("filename")
This will decompress the given archive file to the current
directory. It will automatically pull out the original filename
from the file so you don't need to worry about that. It returns a
zero if the archive could not be accessed. A quick example would be
if Zappo Decompress("testpic.bm_")
if file exist("testpic.bmp")
load bitmap "testpic.bmp"
delete file "testpic.bmp"
else
print "Decompression unsuccessful."
endif
else
print "Archive not found."
endif
This snippet will decompress the archive 'testpic.bm_' and then
open the uncompressed 'testpic.bmp' if it exists. Otherwise it will
report the error.
Compressing your own files:
You can compress your own files using the Microsoft 'compress.exe'
program. Drop to a DOS prompt (e.g. click the 'Start' button, click
'Run' and type 'cmd') and browse to your desired folder. On the
command line type:
compress -R filename
Don't forget the -R so that it stores the original name inside the
archive, and don't forget to type the extension of the file. If the
command is not on your machine you can download it as part of the
Windows 2003 Resource Kit, which also works fine in XP.
Once completed you should see a compressed version of your file
with a filename ending in an underscore, e.g. myfile.bmp would
become myfile.bm_
NOTE: Although the 'compress.exe' program does allow you to create
MS-ZIP files too, they will not work with this DLL. I may add
support for this later if people want it.
Usage Restrictions:
See ReadMe file.
I hope you find it useful. You can download it from here and it includes an example compressed file and DBPro app:
ZappoDecompress.zip (35kb)