home *** CD-ROM | disk | FTP | other *** search
/ Simtel MSDOS - Coast to Coast / simteldosarchivecoasttocoast.iso / pcmag / vol13n05.zip / THINDI.ZIP / THISRC.ZIP / THINDISK.H < prev    next >
C/C++ Source or Header  |  1994-02-14  |  8KB  |  263 lines

  1. //===========================================================
  2. // THINDISK.H -- Header File 
  3. // Copyright (c) 1994 Douglas Boling
  4. //===========================================================
  5. // Equates used by program
  6. #define MAXCOUNT          32767
  7. //#define MAXCOUNT          16384
  8. #define MAXFNAMELEN       256
  9. #define SORTTYPES         4
  10. #define FUNCTYPES         3
  11. #define MAXINCSPECS       8
  12.  
  13. #define DOSERROFFSET      16
  14. #define ERR_CANCELED      -1
  15. #define ERR_OUTOFMEM      -2
  16. #define ERR_TOOMANYFILES  -3
  17. #define ERR_TOODEEP       -4
  18. #define ERR_DISKFULL      -5
  19. #define ERR_NAMETOOLONG   -6
  20. #define ERR_BADNAME       -7 
  21. #define ERR_BADSIZE       -8 
  22. #define ERR_BADDATE       -9 
  23.  
  24. #define SHOW_SIZE         1
  25. #define SHOW_DATE         2
  26. #define SHOW_ATTRIB       4
  27. #define SHOW_PATH         8
  28.  
  29. #define SCRN_BAE          0x0003
  30. #define SCRN_SIZEB        0x0004
  31. #define SCRN_NAME         0x0008
  32. #define SCRN_SIZE         0x0010
  33. #define SCRN_DATE         0x0020
  34. #define SCRN_ATTRS        0x0040
  35. #define SCRN_INCEMPTYDIRS 0x0080
  36. #define SCRN_INCDIRS      0x0100
  37.  
  38. #define DLG_FIND          0x2000
  39. #define DLG_INCLUDE       0x4000
  40. #define DLG_INCLUDEEDIT   0x8000
  41.  
  42. #define ATTR_SELECTED     0x40
  43. #define ATTR_DELETED      0x80
  44. //-----------------------------------------------------------
  45. // Generic defines and data types
  46. //-----------------------------------------------------------
  47. #define WIN16     TRUE
  48. //#define WIN31
  49.  
  50. #define INT       int
  51. #define UINT      WORD
  52. #define APIENTRY  PASCAL
  53. #define WNDPROC   FARPROC
  54.  
  55.  
  56. struct decodeUINT {                         // structure associates
  57.     UINT Code;                              // messages 
  58.     LONG (*Fxn)(HWND, UINT, UINT, LONG);    // with a function
  59. }; 
  60. struct decodeCMD {                          // structure associates
  61.     UINT Code;                              // menu IDs with a 
  62.     LONG (*Fxn)(HWND, UINT, HWND, UINT);    // function
  63. };
  64. //
  65. // Function prototypes used by generic template
  66. //
  67. INT  APIENTRY WinMain(HANDLE, HANDLE, LPSTR, INT);
  68. LONG CALLBACK MainWndProc(HWND, UINT, UINT, LONG);
  69. LONG CALLBACK LBoxSCProc(HWND, UINT, UINT, LONG);
  70.  
  71. INT  InitApp(HANDLE);
  72. INT  InitInstance(HANDLE, LPSTR, INT);
  73. INT  TermInstance(HANDLE, INT);
  74. INT  MyDisplayDialog (HINSTANCE, LPCSTR, HWND, WNDPROC, LPARAM);
  75. BOOL MyWritePrivateProfileInt (char *, char *, int, int, char *);
  76. WNDPROC MySubClassWindow (HWND, WNDPROC);
  77. INT MyCopyFile (char *, char *);
  78. //
  79. // Data types needed for program
  80. //
  81. typedef struct {
  82.     UINT selNext;
  83.     UINT usEnd;
  84.     UINT usSize;
  85. } BUFFHDR;
  86. typedef BUFFHDR far *LPBUFFHDR;
  87.  
  88. typedef struct {
  89.     LPVOID lpParent;
  90.     BYTE ucAttrib;                           // The remainder of this structure
  91.     UINT usTime;                             // must match the C file search 
  92.     UINT usDate;                             // structure.
  93.     LONG lSize;
  94.     char szName[13];
  95. } MYDIRENTRY;       
  96. typedef MYDIRENTRY far * LPMYDIRENTRY;
  97. typedef LPMYDIRENTRY huge * LPLPMYDIRENTRY;
  98.  
  99. typedef DWORD huge *HPDWORD;
  100.  
  101. typedef struct {
  102.     char szSpecName[SPECNAMELEN];
  103.     char szFileSpec[15];
  104.     UINT usIncFlags;
  105.     UINT usIncDate;
  106.     LONG lIncSize;
  107.     UINT fScrnFlags;
  108. } INCSPEC;
  109. typedef INCSPEC * PINCSPEC;
  110. typedef INCSPEC far * LPINCSPEC;
  111. typedef INT (*SORTFUNC) (LPVOID, LPVOID);
  112. typedef SORTFUNC *PSORTFUNC;
  113. typedef INT (*FILEFUNC) (LPMYDIRENTRY, char *, char *, char *);
  114.  
  115. typedef struct find_t FIND_T;
  116. typedef struct DOSERROR DOSERR;
  117. //
  118. // Program specific prototypes
  119. //
  120. // Dialog functions
  121. BOOL CALLBACK AboutDlgProc (HWND, UINT, UINT, LONG);
  122. BOOL CALLBACK RefreshDlgProc (HWND, UINT, UINT, LONG);
  123. BOOL CALLBACK MoveCopyDelDlgProc (HWND, UINT, UINT, LONG);
  124. BOOL CALLBACK IncFilesDlgProc (HWND, UINT, UINT, LONG);
  125. BOOL CALLBACK IncludeDelDlgProc (HWND, UINT, UINT, LONG);
  126. // Message handler functions
  127. LONG DoCreateMain (HWND, UINT, UINT, LONG);
  128. LONG DoInitMenuMain (HWND, UINT, UINT, LONG);
  129. LONG DoSizeMain (HWND, UINT, UINT, LONG);
  130. LONG DoSetFocusMain (HWND, UINT, UINT, LONG);
  131. LONG DoDrawItemMain (HWND, UINT, UINT, LONG);
  132. LONG DoMeasureItemMain (HWND, UINT, UINT, LONG);
  133. LONG DoCloseMain (HWND, UINT, UINT, LONG);
  134. LONG DoDestroyMain (HWND, UINT, UINT, LONG);
  135. LONG DoCommandMain (HWND, UINT, UINT, LONG);
  136. // Control function Prototypes
  137. LONG DoMainCtlFList (HWND, UINT, HWND, UINT);
  138. LONG DoMainMenuRefresh (HWND, UINT, HWND, UINT);
  139. LONG DoMainMenuMCD (HWND, UINT, HWND, UINT);
  140. LONG DoMainMenuExit (HWND, UINT, HWND, UINT);
  141. LONG DoMainMenuFind (HWND, UINT, HWND, UINT);
  142. LONG DoMainMenuInvert (HWND, UINT, HWND, UINT);
  143. LONG DoMainMenuShow (HWND, UINT, HWND, UINT);
  144. LONG DoMainMenuSort (HWND, UINT, HWND, UINT);
  145. LONG DoMainMenuInclude (HWND, UINT, HWND, UINT);
  146. LONG DoMainMenuIncludeEdit (HWND, UINT, HWND, UINT);
  147. LONG DoMainMenuIncludeDel (HWND, UINT, HWND, UINT);
  148. LONG DoMainMenuIncludeSet (HWND, UINT, HWND, UINT);
  149. LONG DoMainMenuAbout (HWND, UINT, HWND, UINT);
  150. // Utility function prototypes
  151. void GetFListPos (HWND, RECT *);
  152. INT AddIncSet (HWND, PINCSPEC);
  153. void Date2asc (UINT, UINT, char *);
  154. void Attr2asc (BYTE, char *);
  155. void CreatePath (LPMYDIRENTRY, char *, int *);
  156. void DisplayCurrStatus (HWND);
  157. INT GetIncludedFiles (HWND);
  158. HGLOBAL GetIncludedSet (LPMYDIRENTRY, INT *);
  159. BOOL ScreenFile (LPMYDIRENTRY, LPINCSPEC);
  160. INT MyQSort (LPVOID, UINT, PSORTFUNC);
  161. BOOL MyYield (void);
  162. void InvertIndex (HPDWORD, UINT);
  163. INT SortName (LPVOID, LPVOID);
  164. INT SortExt (LPVOID, LPVOID);
  165. INT SortSize (LPVOID, LPVOID);
  166. INT SortDate (LPVOID, LPVOID);
  167. INT SortPath (LPVOID, LPVOID);
  168. INT ScanDisk (HWND, LPMYDIRENTRY, INT);
  169. INT ScanMachine (HWND, INT, INT *);
  170. INT CopyFile (LPMYDIRENTRY, char *, char *, char *);
  171. INT DeleteFile (LPMYDIRENTRY, char *, char *, char *);
  172. INT MoveFile (LPMYDIRENTRY, char *, char *, char *);
  173. void FillLB (HWND, INT);
  174. void PrintError (HWND, INT);
  175. //
  176. // Profile String Names
  177. //
  178. #define     PRO_XPOS      "WinPosX"
  179. #define     PRO_YPOS      "WinPosY"
  180. #define     PRO_XSIZE     "WinSizeX"
  181. #define     PRO_YSIZE     "WinSizeY"
  182.  
  183. #define     PRO_INCCNT    "IncCount"
  184. #define     PRO_SPECNAME  "SpecName"
  185. #define     PRO_FILESPEC  "FileSpec"
  186. #define     PRO_INCSIZE   "IncSize"
  187. #define     PRO_INCDATE   "IncDate"
  188. #define     PRO_INCFLAGS  "IncFlags"
  189. #define     PRO_SCRNFLAGS "ScrnFlags"
  190. //
  191. // Resource Identifiers
  192. //
  193. #define     MENU_VIEW        2
  194. #define     MENU_INCLUDE     3
  195.  
  196. #define     IDD_FLIST        100
  197. #define     IDD_FSCROLL      101
  198.  
  199. #define     IDM_REFRESH      200
  200. #define     IDM_OPEN         201
  201. #define     IDM_COPY         202           //Keep copy move and delete in order
  202. #define     IDM_MOVE         203
  203. #define     IDM_DELETE         204
  204. #define     IDM_EXIT         205
  205.  
  206. #define     IDM_FIND         210
  207. #define     IDM_FINDNEXT     211
  208. #define     IDM_FINDPREV     212
  209.  
  210. #define     IDM_SORTUPDN     221
  211. #define     IDM_SORTNAME     222           //Keep sort and show IDs in this order
  212. #define     IDM_SORTEXT      223
  213. #define     IDM_SORTSIZE     224
  214. #define     IDM_SORTDATE     225
  215. #define     IDM_SORTPATH     226
  216. #define     IDM_SHOWSIZE     227
  217. #define     IDM_SHOWDATE     228
  218. #define     IDM_SHOWATTRIB   229
  219. #define     IDM_SHOWPATH     230
  220.  
  221. #define     IDM_INCLUDE      240
  222. #define     IDM_INCLUDEDEL   241
  223. #define     IDM_INCLUDEEDIT  242
  224. #define     IDM_INCLUDEALL   243           //Leave 7 numbers above this ID free
  225.  
  226. #define     IDM_ABOUT         260
  227.  
  228. #define     IDD_SPECNAME     300
  229. #define     IDD_CHKFSPEC     301
  230. #define     IDD_FSPEC         302
  231. #define     IDD_CHKFSIZE     303
  232. #define     IDD_FSIZE         304
  233. #define     IDD_FSIZEUP         305
  234. #define     IDD_FSIZEDN         306
  235. #define     IDD_CHKFDATE     307
  236. #define     IDD_FDATE         308
  237. #define     IDD_FDATEB         309
  238. #define     IDD_FDATEA         310
  239. #define     IDD_FDATEO         311
  240. #define     IDD_CHKFATTRS    312
  241. #define     IDD_CHKFARDONLY  313
  242. #define     IDD_CHKFAARCH    314
  243. #define     IDD_CHKFAHIDDEN  315
  244. #define     IDD_CHKFASYSTEM  316
  245. #define     IDD_INCDIRS      317
  246. #define     IDD_INCEMPTYDIRS 318
  247. #define     IDD_SAVEAS       319
  248.  
  249. #define     IDD_REFRESHTEXT  400
  250. #define     IDD_DRVLIST      401
  251. #define     IDD_REFRESH      402
  252.  
  253. #define     IDD_COPYTEXT     500
  254. #define     IDD_FILELIST     501
  255. #define     IDD_DESTPATH     502
  256.  
  257. #define     IDD_INCLIST      530
  258.  
  259. #define     IDD_PROGSTR      600
  260.  
  261.  
  262.  
  263.