Unit AFCInter

Classes

Functions

ChfUnzip_Init -
CloseZipFile - zprec: record, will be filled with zipfile data, do not change the 'internal' field received from previous calls!
FileUnzip - *******************************************************************} {*********************************************************************} {************** The African Chief's functions ************************} {*********************************************************************} {

The Chief!
FileUnzipEx -
GetFirstInZip - Hi byte=number before period, Lo byte=number after period} {Later versions will be downward compatible} {******************** ZIP central directory access *******************} {The following 3 functions can be called in a loop to retreive all the files in the given zip file.
GetNextInZip - zipfilename: filename of zip file} {zprec: record, will be filled with zipfile data
GetSupportedMethods - Tests if given file is a zip file (only test for PK#3#4 at the beginning)} {***************** Get Unzip Methods supported by DLL ****************} {Currently (version 1.
GetUnzipDllVersion - *******************************************************************} {*********************************************************************} {*************************** original functions **********************} {*********************************************************************} {*********************************************************************} {******************* DLL version

usage: in_name: name of zip file with full path out_name: desired name for out file offset: header position of desired file in zipfile, found in tZiprec hFileAction: handle to dialog box showing advance of decompression (optional), or zero when only keyboard shall be checked cm_index: - if hfileaction<>0 : notification code sent in a wm_command message to the dialog to update percent-bar - if hfileaction=0 : virtual key code of key the user must press to interrupt unzipping, i.
isZip - Call after last GetNextInZip call to free buffer} {********************* Test if file is a ZIP file
SetUnZipQuestionProc -
SetUnZipReportProc -
unzipfile - Method 0 supported -> bit 0 = 1, Method 8 supported -> bit 8 = 1, etc.
UnZipSize -
Viewzip -

Types

Constants

Variables


Functions


PROCEDURE ChfUnzip_Init;


PROCEDURE CloseZipFile ( VAR Zprec : tZiprec );

zprec: record, will be filled with zipfile data, do not change the 'internal' field received from previous calls!

FUNCTION FileUnzip ( SourceZipFile, TargetDirectory, FileSpecs : pChar; Report : UnzipReportProc;Question : UnzipQuestionProc ) : integer;

*******************************************************************} {*********************************************************************} {************** The African Chief's functions ************************} {*********************************************************************} {

The Chief!


FUNCTION FileUnzipEx ( SourceZipFile, TargetDirectory, FileSpecs : pChar ) : integer;


FUNCTION GetFirstInZip ( zipfilename : pchar;VAR zprec : tZipRec ) : integer;

Hi byte=number before period, Lo byte=number after period} {Later versions will be downward compatible} {******************** ZIP central directory access *******************} {The following 3 functions can be called in a loop to retreive all the files in the given zip file. Use these functions similar to findfirst and findnext: Example: var r:tziprec; rc:=GetFirstInZip(zipname,r); while rc=zip_ok do DosomethingWithData(r); rc:=GetNextInZip(r); end; closezipfile(r); case rc of zip_FileError:messagebox(hwindow,'Error reading ZIP file!',zipname,mb_ok); zip_InternalError:messagebox(hwindow,'Internal error in ZIP file!',zipname,mb_ok); end;

FUNCTION GetNextInZip ( VAR Zprec : tZiprec ) : integer;

zipfilename: filename of zip file} {zprec: record, will be filled with zipfile data

FUNCTION GetSupportedMethods : longint;

Tests if given file is a zip file (only test for PK#3#4 at the beginning)} {***************** Get Unzip Methods supported by DLL ****************} {Currently (version 1.0) these are stored (0), shrunk (1), imploded (6) and deflated (8

FUNCTION GetUnzipDllVersion : word;

*******************************************************************} {*********************************************************************} {*************************** original functions **********************} {*********************************************************************} {*********************************************************************} {******************* DLL version

usage: in_name: name of zip file with full path out_name: desired name for out file offset: header position of desired file in zipfile, found in tZiprec hFileAction: handle to dialog box showing advance of decompression (optional), or zero when only keyboard shall be checked cm_index: - if hfileaction<>0 : notification code sent in a wm_command message to the dialog to update percent-bar - if hfileaction=0 : virtual key code of key the user must press to interrupt unzipping, i.e. vk_escape Return value: one of the above unzip_xxx codes Example for handling the cm_index message in a progress dialog: unzipfile(......,cm_showpercent); ... procedure TFileActionDialog.wmcommand(var msg:tmessage); var ppercent:^word; begin TDialog.WMCommand(msg); if msg.wparam=cm_showpercent then begin ppercent:=pointer(lparam); if ppercent<>nil then begin if (ppercent^>=0) and (ppercent^<=100) then SetProgressBar(ppercent^); if UserPressedAbort then ppercent^:=$ffff else ppercent^:=0; end; end; end; end;


FUNCTION isZip ( filename : pchar ) : boolean;

Call after last GetNextInZip call to free buffer} {********************* Test if file is a ZIP file

FUNCTION SetUnZipQuestionProc ( aProc : UnzipQuestionProc ) : Pointer;


FUNCTION SetUnZipReportProc ( aProc : UnzipReportProc ) : Pointer;


FUNCTION unzipfile ( in_name : pchar;out_name : pchar;offset : longint; hFileAction : hwnd;cm_index : integer ) : integer;

Method 0 supported -> bit 0 = 1, Method 8 supported -> bit 8 = 1, etc.} {********************* unzip a file from ZIP-file

FUNCTION UnZipSize ( SourceZipFile : pChar;VAR Compressed : Longint ) : longint;


FUNCTION Viewzip ( SourceZipFile, FileSpecs : pChar; Report : UnzipReportProc ) : integer;


Types


Constants


Variables