home *** CD-ROM | disk | FTP | other *** search
/ Chip 1998 March / Chip_1998-03_cd.bin / zkuste / delphi / komprese / zip / DELZIP12.ZIP / DOC.ZIP / BC-CMPLE.TXT next >
Text File  |  1997-09-28  |  6KB  |  144 lines

  1.  
  2.                 Borland C/C++ Compiler
  3.  
  4.  
  5. If you want to use the Zip DLLs with a non-VCL version
  6. of the Borland compiler, this is how to do it:
  7.  
  8.  1) Create a .lib file for each DLL with IMPLIB.EXE
  9.     Do NOT use the VC++ version of the .lib files!
  10.  
  11.  2) Create a small .DEF file with the names of the 2 imported
  12.     functions.  If you have a naming conflict due to the lack
  13.     of "_" in front of the functions, then make aliases in 
  14.     your .DEF file for them
  15.  
  16.  3) Add the .DEF to your project
  17.  
  18.  4) Create .h files giving the DLL function definitions
  19.     (be sure to specify stdcall calling convention; which
  20.      is part of WINAPI).  Here's the general idea:
  21.  
  22.  
  23. file = zip.h
  24. ==============================================================
  25. #include <windows.h>
  26.  
  27. /* define the data passed back to the callback function */
  28. typedef struct {
  29.    HWND handle;
  30.    long caller;
  31.    long version;
  32.    BOOL isoperationzip; // true=zip, false=unzip
  33.    long actioncode;
  34.    long error_code;
  35.    long fsize;
  36.    char filenameormsg[512]; /* NOTE: NOT a pointer - data is here */
  37. } callbackstruct;
  38.  
  39. // Define a type called DLLCALLBACK:
  40. // We can't use BOOL as return type in the following typedef, so we use "long".
  41. // typedef __declspec(dllimport) long (CALLBACK *DLLCALLBK) (callbackstruct *);
  42. typedef long (CALLBACK *DLLCALLBK) (callbackstruct *);
  43.  
  44. /* The BOOL type in Win32 is the same as Delphi's LongBool */
  45. typedef struct {
  46.    HWND handle;        /* handle of calling pgm's active Window */
  47.    long caller;        /* object instance ("self") of calling Delphi form 
  48.                      (not used in DLL; returned to Delphi via callback) */
  49.    long version;       /* version no. that Delphi Applic. expects */
  50.    DLLCALLBK callback;
  51.    BOOL fTraceEnabled;
  52.  
  53.    BOOL fEncryptVerify; /* not supported yet */
  54.    BOOL fSuffix;     /* not supported yet */
  55.    BOOL fEncrypt;    /* not supported yet */
  56.  
  57.    BOOL fSystem;          /* include system and hidden files */
  58.    BOOL fVolume;          /* Include volume label */
  59.    BOOL fExtra;           /* Include extra attributes */
  60.    BOOL fNoDirEntries;    /* Do not add directory entries */
  61.    BOOL fDate;            /* Exclude files earlier than specified date */
  62.    BOOL fVerbose;         /* Mention oddities in zip file structure */
  63.    BOOL fQuiet;           /* Quiet operation */
  64.  
  65.    int fLevel;            /* Compression level (0 - 9) */
  66.    BOOL fComprSpecial;    /* try to compress files that are alreay compressed */
  67.    BOOL fCRLF_LF;          /* Translate end-of-line */
  68.    BOOL fJunkDir;          /* Junk (remove) directory names */
  69.    BOOL fRecurse;          /* Recurse into subdirectories */
  70.    BOOL fGrow;             /* Allow appending to a zip file */
  71.    BOOL fForce;            /* Make entries using DOS names (k for Katz) */
  72.    BOOL fMove;             /* Delete files added or updated in zip file */
  73.    BOOL fDeleteEntries;    /* Delete files from zip file */
  74.    BOOL fUpdate;           /* Update zip file--overwrite only if newer */
  75.    BOOL fFreshen;          /* Freshen zip file--overwrite only */
  76.    BOOL fJunkSFX;          /* Junk SFX prefix */
  77.    BOOL fLatestTime;       /* Set zip file time to time of latest file in it */
  78.  
  79.    char Date[7];           /* Date to include after (MMDDYY + 1 null) */
  80.    int  argc;              /* Count of filespecs to zip or delete */
  81.    LPSTR lpszZipFN;        /* name of zip file */
  82.    int seven;              /* stick a 7 in here to validate the struct offsets */
  83.    char *FNV[];            /* array of filespec strings */
  84. } ZCL, *LPZCL;
  85.  
  86. /* exports from DLL (must also be listed in the DEF file) */
  87. long WINAPI ZipDllExec(ZCL *C);
  88. long WINAPI GetZipDllVersion(void);
  89.  
  90.  
  91.  
  92. file = unzip.h
  93. //==============================================================
  94. #include <windows.h>
  95.  
  96. /* define the data passed back to the Delphi callback function */
  97. typedef struct {
  98.    HWND handle;
  99.    long caller;
  100.    long version;
  101.    BOOL isoperationzip; // true=zip, false=unzip
  102.    long actioncode;
  103.    long error_code;
  104.    long fsize;
  105.    char filenameormsg[512]; /* NOTE: NOT a pointer - data is here */
  106. } callbackstruct;
  107.  
  108. // We can't use BOOL as return type in the following typedef, so we use "long".
  109. // typedef __declspec(dllimport) long (CALLBACK *DLLCALLBK) (callbackstruct *);
  110. typedef long (CALLBACK *DLLCALLBK) (callbackstruct *);
  111.  
  112. // DLL Command Line (DCL)
  113. typedef struct {
  114.    HWND handle;        /* handle of calling pgm's active Window */
  115.    long caller;        /* object instance ("self") of calling Delphi form
  116.                      (not used in DLL; returned to Delphi via callback) */
  117.    long version;       /* version no. that Delphi Applic. expects */
  118.    DLLCALLBK callback;
  119.    BOOL fTraceEnabled;
  120.    /*==================*/
  121.    /* regular switches */
  122.    BOOL fPromptToOverwrite; // not supported yet
  123.    BOOL fDecrypt;           // not supported yet
  124.    BOOL fTest;              // if true, test zipfile (not supported yet)
  125.    BOOL fComments;           // show zip comment (not supported yet)
  126.    BOOL fConvert;           // if true, do ASCII/EBCDIC or EOL translation
  127.  
  128.    BOOL fQuiet;          // DLL be quiet!
  129.    BOOL fVerbose;        // verbose flag
  130.    BOOL fUpdate;         // "update" (extract only newer files & brand new files)
  131.    BOOL fFreshen;        // "freshen" (extract only newer files that already exist)
  132.    BOOL fDirectories;    // if true, recreate dir structure
  133.    BOOL fOverwrite;      // if true, overwrite existing (no asking)
  134.  
  135.    long argc;          //  Count of filespecs to extract
  136.    LPSTR lpszZipFN;    // ptr to zip filename
  137.    int seven;          // stick a 7 in here to validate the struct offsets
  138.    char *FNV[];        // array of filespec args to extract
  139. } DCL, _far *LPDCL;
  140.  
  141. /* Exports from the DLL */
  142. long WINAPI UnzDllExec(DCL *C);
  143. long WINAPI GetUnzDllVersion(void);
  144.