home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 14 / CDACTUAL.iso / cdactual / demobin / share / program / c / WUNZ13SR.ZIP / WIZUNZIP.H < prev    next >
Encoding:
C/C++ Source or Header  |  1992-07-02  |  9.6 KB  |  265 lines

  1. #include <windows.h>
  2. #include <assert.h>    /* required for all Windows applications */
  3. #include <commdlg.h>
  4. #include <dlgs.h>
  5.  
  6. /* Main include file for  Windows Unzip: unzip.h
  7.  * This include file is copied into all `C' source modules specific to 
  8.  * Windows Info-ZIP Unzip.
  9.  * Author: Robert A. Heath, 157 Chartwell Rd., Columbia, SC 29210
  10.  * I, Robert A. Heath, place this module, wizunzip.h, in the public domain.
  11.  */
  12.  
  13. /* These two are dependent on zip directory listing format string.
  14.  * They help find the filename in the listbox entry.
  15.  */
  16. #define SHORT_FORM_FNAME_INX    27
  17. #define LONG_FORM_FNAME_INX 58
  18.  
  19. #define MIN_SHORT_FORMAT_CHARS (SHORT_FORM_FNAME_INX+12)
  20. #define MIN_LONG_FORMAT_CHARS (LONG_FORM_FNAME_INX+12)
  21.  
  22. /* Arbitrary Constants
  23.  */
  24. #define BG_SYS_COLOR COLOR_GRAYTEXT /* background color is a system color */
  25.  
  26. /* Main window menu item positions
  27.  */
  28. #define HELP_MENUITEM_POS       5   /* the Help menu                */
  29.  
  30. /* Main Window Message Codes
  31.  */
  32.  
  33. #define IDM_OPEN            101
  34. #define IDM_EXIT            102
  35.  
  36. #define IDM_SHORT           104
  37. #define IDM_LONG            105
  38.  
  39.  
  40. #define IDM_HELP            106
  41. #define IDM_ABOUT           107
  42.  
  43. #define IDM_RECR_DIR_STRUCT 108
  44. #define IDM_OVERWRITE       109
  45. #define IDM_TRANSLATE       110
  46. #define IDM_UNZIP_TO_ZIP_DIR 111
  47.  
  48. #define IDM_EDIT            112
  49. #define IDM_PATH            113
  50.  
  51.  
  52. #define IDM_COMMENT         117
  53. #define IDM_BEEP_ON_FINISH  118
  54. #define IDM_SELECT_ALL      120
  55.  
  56. /* These six items are the tab-stop windows whose ID's must be kept
  57.  * in order.
  58.  */
  59. #define IDM_LISTBOX         121
  60. #define IDM_EXTRACT         122
  61. #define IDM_DISPLAY         123
  62. #define IDM_TEST            124
  63. #define IDM_SHOW_COMMENT    125
  64. #define IDM_STATUS          126
  65. #define TABSTOP_ID_BASE IDM_LISTBOX
  66.  
  67. #define IDM_MAX_STATUS      127
  68. #define IDM_RESTORE_STATUS  128
  69. #define IDM_SHOWHIDE_STATUS 129
  70.  
  71. #define IDM_LB_EXTRACT      135
  72. #define IDM_LB_DISPLAY      136
  73. #define IDM_LB_TEST         137
  74. #define IDM_DESELECT_ALL    138
  75. #define IDM_CLEAR_STATUS    139
  76. #define IDM_HELP_KEYBOARD   140
  77. #define IDM_HELP_HELP       141
  78. #define IDM_CHDIR           142
  79.  
  80.  
  81. /* Help Window Menu and Message ID's
  82.  */
  83. #define INDEX_MENU_ITEM_POS 0
  84.  
  85. #define IDM_FORWARD 100
  86. #define IDM_BACKWARD 101 
  87.  
  88.  
  89. /* Tab-stop table is used to sub-class those main window items to
  90.  * which the tab and back-tab keys will tab and stop.
  91.  */
  92. typedef struct TabStop_tag {
  93.     FARPROC lpfnOldFunc;        /* original function                */
  94.     HWND hWnd ;         
  95. } TabStopEntry;
  96.  
  97. typedef TabStopEntry *PTABSTOPENTRY;
  98. #define TABSTOP_TABLE_ENTRIES 6
  99.  
  100.  
  101. #ifndef NDEBUG
  102. #define WinAssert(exp) \
  103.         {\
  104.         if (!(exp))\
  105.             {\
  106.             char szBuffer[40];\
  107.             sprintf(szBuffer, "File %s, Line %d",\
  108.                     __FILE__, __LINE__) ;\
  109.             if (IDABORT == MessageBox((HWND)NULL, szBuffer,\
  110.                 "Assertion Error",\
  111.                 MB_ABORTRETRYIGNORE|MB_ICONSTOP))\
  112.                     FatalExit(-1);\
  113.             }\
  114.         }
  115.  
  116. #else
  117.  
  118. #define WinAssert(exp)
  119.  
  120. #endif
  121.  
  122.  
  123. /* Unzip Flags */
  124. typedef struct
  125. {
  126.     unsigned int    fRecreateDirs : 1;
  127.     unsigned int    fTranslate : 1;
  128.     unsigned int    fFormatLong : 1;
  129.     unsigned int    fOverwrite : 1;
  130.     unsigned int    fUnzipToZipDir : 1;
  131.     unsigned int    fBeepOnFinish : 1;
  132.     unsigned int    fDoAll : 1;
  133.     unsigned int    fIconSwitched : 1;
  134.     unsigned int    fStatusMaximized : 1;
  135.     unsigned int    fStatusHidden : 1;
  136.     unsigned int    fHelp : 1;
  137.     unsigned int    fCanDragDrop : 1;
  138.     unsigned int    fUnused : 4;
  139. } UF, *PUF;
  140.  
  141. /* Unzip Miscellaneous Buffers */
  142. typedef struct
  143. {
  144.     char szFileName[128];       /* fully-qualified file name in OEM char set */
  145.     char szDirName[128];
  146.     char szOrigDirName[128];    /* original directory name */
  147.     char szTotalsLine[80];      /* text for totals of zip archive */
  148.     char szBuffer[256];         /* option strings from WIN.INI  */
  149.     OPENFILENAME ofn;
  150.     MSG msg;
  151.     OFSTRUCT of;
  152. } UMB, __far *LPUMB;
  153.  
  154. extern TabStopEntry TabStopTable[]; /* tab-stop control table           */
  155.  
  156. extern short dxChar, dyChar;    /* size of char in SYSTEM font in pixels    */
  157.  
  158. extern HANDLE hFixedFont;
  159.  
  160. extern HWND hWndComment;        /* comment window                       */
  161. extern HWND hWndList;       /* listbox handle                       */
  162.  
  163. extern HWND hWndMain;        /* the main window handle.         */
  164.  
  165. extern HWND hExtract;           /* extract button               */
  166. extern HWND hDisplay;           /*display button                */
  167. extern HWND hTest;              /* test button                  */
  168. extern HWND hShowComment;       /* show comment button          */
  169. extern HANDLE hInst;                       /* current instance                      */
  170. extern HMENU  hMenu;                /* main menu handle         */
  171. extern HANDLE hAccTable;
  172.  
  173. extern HANDLE hHourGlass;             /* handle to hourglass cursor      */
  174. extern HANDLE hSaveCursor;            /* current cursor handle       */
  175. extern HANDLE hHelpCursor;          /* help cursor              */
  176. extern HANDLE hFixedFont;           /* handle to fixed font             */
  177. extern HANDLE hOldFont;         /* handle to old font               */
  178.  
  179. extern int hFile;                 /* file handle             */
  180. extern HWND hWndList;             /* list box handle        */
  181. extern HWND hWndStatus;     /* status   */
  182. extern BOOL bRealTimeMsgUpdate; /* update messages window in real-time */
  183.  
  184. #if 0
  185. extern BOOL bStatusMaxed ;  /* status box is maximized when true        */
  186. extern BOOL bDoAll;             /* referenced in file_io.c      */
  187. extern BOOL bIconSwitched;  /* set true after 1st valid action  */
  188. extern BOOL bHelp;          /* help key has been hit when TRUE          */
  189. extern BOOL bRecreateDirs;  /* re-create directory structures when TRUE */
  190. extern BOOL bTranslate; /* translate LF to CR-LF                    */
  191. extern WORD wFormat;        /* display format: 0 = short, 1 = long */
  192. extern BOOL bOverwrite;     /* overwrite files: IDM_PROMPT, IDM_OVERWRITE */
  193. extern BOOL bUnzipToZipDir; /* unzip to .ZIP dir; else keep separate */
  194. extern BOOL bBeepOnFinish;
  195. #endif
  196. extern UF uf;
  197.  
  198. extern WORD wLBSelection;   /* default listbox selection action */
  199.  
  200. extern HBRUSH hBrush ;          /* brush for  standard window backgrounds  */
  201.  
  202. extern char __based(__segname("STRINGS_TEXT")) szAppName[];     /* application name             */
  203. extern char __based(__segname("STRINGS_TEXT")) szStatusClass[]; /* status class name                */
  204. extern char __based(__segname("STRINGS_TEXT")) szBeepOnFinish[];
  205. extern char __based(__segname("STRINGS_TEXT")) szFormatKey[];       /* Format WIN.INI keyword       */
  206. extern char __based(__segname("STRINGS_TEXT")) szOverwriteKey[];    /* Overwrite WIN.INI keyword        */
  207. extern char __based(__segname("STRINGS_TEXT")) szTranslateKey[];    /* Translate WIN.INI keyword        */
  208. extern char __based(__segname("STRINGS_TEXT")) szLBSelectionKey[];  /* LBSelection keyword in WIN.INI */
  209. extern char __based(__segname("STRINGS_TEXT")) szRecreateDirsKey[]; /* re-create directory structure 
  210.                                     WIN.INI keyword             */
  211. extern char __based(__segname("STRINGS_TEXT")) szUnzipToZipDirKey[];   /* unzip to .ZIP dir WIN.INI keyword */
  212. extern char __based(__segname("STRINGS_TEXT")) szHideStatus[];   /* unzip to .ZIP dir WIN.INI keyword */
  213. extern char * LBSelectionTable[];
  214. extern char __based(__segname("STRINGS_TEXT")) szNoMemory[] ;       /* error message            */
  215. extern char __based(__segname("STRINGS_TEXT")) szHelpFileName[];        /* help file name                       */
  216. extern char __based(__segname("STRINGS_TEXT")) szYes[];
  217. extern char __based(__segname("STRINGS_TEXT")) szNo[];
  218. extern char * Headers[][2] ;        /* headers to display           */
  219.  
  220. extern WORD cchComment; /* length of comment in .ZIP file   */
  221.  
  222. extern LPUMB lpumb;
  223. #if 0
  224. extern char __far *lpszFileName;        /* current file name in ANSI        */
  225. extern char __far *lpszDirName;
  226. extern char __far *lpszOrigDirName; /* original directory name      */
  227. extern char __far *lpszTotalsLine;
  228. extern char __far *lpszBuffer;
  229. #endif
  230.  
  231. /* List box stuff
  232.  */
  233. extern WORD cZippedFiles;       /* total personal records in file   */
  234. extern WORD cListBoxLines; /* max list box lines showing on screen */
  235. extern WORD cLinesMessageWin; /* max visible lines on message window  */
  236.  
  237. /* Function Prototypes */
  238.  
  239. void SetCaption(HWND hWnd);
  240.  
  241. /* some global functions */
  242. void Action(HWND hWnd, WORD wActionCode);
  243. void DisplayComment(HWND hWnd);
  244. int CLBItemsGet(HWND hListBox, int __far * __far *ppnSelItems, HANDLE *phnd);
  245. void ReselectLB(HWND hListBox, int nSelCount, int __far *pnSelItems);
  246. BOOL FSetUpToProcessZipFile(int ncflag, int ntflag, int nvflag, int nUflag, 
  247.                             int nzflag, int ndflag, int noflag, int naflag,
  248.                             int argc, LPSTR lpszZipFN, PSTR *FNV);
  249. void TakeDownFromProcessZipFile(void);
  250. void SizeWindow(HWND hWnd, BOOL bOKtoMovehWnd);
  251. void UpdateButtons(HWND hWnd);
  252. void UpdateListBox(HWND hWnd);
  253. void UpdateMsgWndPos(void);
  254. BOOL WizUnzipInit(HANDLE hInst);
  255. void WriteBufferToMsgWin(LPSTR buffer, int nBufferLen, BOOL bUpdate);
  256. void WriteStringToMsgWin(PSTR String, BOOL bUpdate);
  257.  
  258. /* Far Proc's */
  259. BOOL FAR PASCAL AboutProc(HWND, WORD, WORD, LONG);
  260. BOOL FAR PASCAL SelectDirProc(HWND, WORD, WORD, LONG);
  261. long FAR PASCAL KbdProc(HWND, WORD, WORD, LONG);
  262. BOOL FAR PASCAL ReplaceProc(HWND, WORD, WORD, LONG);
  263. long FAR PASCAL StatusProc (HWND, WORD, WORD, LONG); 
  264. BOOL FAR PASCAL RenameProc (HWND, WORD, WORD, LONG); 
  265.