home *** CD-ROM | disk | FTP | other *** search
/ C Programming Starter Kit 2.0 / SamsPublishing-CProgrammingStarterKit-v2.0-Win31.iso / bde / inventry.pak / INVENTRY.H < prev    next >
Encoding:
C/C++ Source or Header  |  1997-07-24  |  4.8 KB  |  137 lines

  1. // Borland C++ - (C) Copyright 1994 by Borland International
  2.  
  3. #include <windows.h>
  4. #include <ctl3d.h>
  5. #include <idapi.h>
  6. #include <string.h>
  7. #include <io.h>
  8. #include <dos.h> // for date structure and getdate function
  9. #include <malloc.h>   // malloc
  10. #include <stdio.h>
  11. #include <stdlib.h>  // atoi
  12. #include <direct.h>
  13. #include <errno.h>
  14. #include "id_defs.h"
  15. #include "macro.h"
  16.  
  17. // Definitions needed for engine.c
  18. #define IDLENGTH     6
  19. #define FLDLENGTH    50
  20. #define FLTLENGTH    20
  21. #define DATELEN      14
  22. #define COMMENTLEN   300
  23.  
  24. #define TOP         0
  25. #define BOTTOM      2
  26. #define PREV_REC    -1
  27. #define NEXT_REC    1
  28. #define RANGEERROR  2
  29.  
  30.  
  31. // Externs for global data
  32. extern HINSTANCE    hInst;
  33. extern HWND         hMainWnd;
  34. extern HWND         hErrorWnd;
  35. extern BOOL         NewRecMode;
  36. extern BOOL         RangeSet;
  37. extern WNDPROC      _wpOrigWndProc;
  38. extern char         szNoneOnOrder[];
  39.  
  40. // Variables for ENGINE.C
  41. typedef struct  {
  42.                         CHAR   ItemId[IDLENGTH];
  43.                         CHAR   Building[FLDLENGTH];
  44.                         CHAR   Item[FLDLENGTH];
  45.                         CHAR   In_Stock[FLTLENGTH];
  46.                         CHAR   Cost[FLTLENGTH];
  47.                         CHAR   DateD[DATELEN];
  48.                         CHAR   Message[COMMENTLEN];
  49.                 } RecordType;
  50.  
  51. // Function prototypes for INV_MAIN.C
  52. long        FAR _pascal _export MainDlgProc (HWND, UINT, WPARAM, LPARAM);
  53. BOOL        InitApp(int nCmdShow);
  54. long        FAR _pascal _export EditSubClassProc(HWND, WORD, WORD, LONG);
  55. BOOL        FAR _pascal _export AboutDlg(HWND, WORD, WORD, LONG);
  56. BOOL        FAR _pascal _export OrderDlg(HWND, WORD, WORD, LONG);
  57. BOOL        FAR _pascal _export RangeDlg(HWND, WORD, WORD, LONG);
  58. BOOL        FAR _pascal _export SearchDlg(HWND, WORD, WORD, LONG);
  59. BOOL        FillStruct(RecordType *, UINT16);
  60. BOOL        DisplayTable(hDBICur);
  61. BOOL        TableExist(pCHAR);
  62. BOOL        FillTable(hDBICur, phDBIDb);
  63. BOOL        DispRec(RecordType *);
  64. void        MoveRec (hDBICur, INT16);
  65. void        CheckButtons(hDBICur);
  66. void        SetupEdits(void);
  67. BOOL        SaveRec(hDBICur, BOOL);
  68. BOOL        GetRec(RecordType *);
  69. BOOL        DeleteRecord(hDBICur);
  70. void        SetControl(UINT16, BOOL);
  71. UINT16      FillDropList (HWND, hDBICur, UINT16);
  72. void        SetItemFocus(void);
  73. BOOL        ClearDlg(void);
  74. BOOL        verified(void);
  75. BOOL        CanContinue(pCHAR, UINT16);
  76. void        EndNewRec(hDBICur);
  77. void        SetDefaultDate(void);
  78. void        FillFieldList(HWND);
  79. void        GetField(RecordType *, pCHAR, UINT16);
  80. void        PutField(RecordType *, pCHAR, UINT16);
  81. void        SetFieldLength(HWND, UINT16, UINT16, UINT16, BOOL);
  82. UINT16      GetCond(HWND);
  83.  
  84. // Function prototypes for INV_UTIL.C
  85. UINT16 WinMsg(pCHAR, UINT16, UINT16);
  86. void ChangeEntryMode(void);
  87. int MakeFullPath(pCHAR pszDirectory, pCHAR pszRelativeDirectory);
  88.  
  89. // Functions for ENGINE.C
  90. DBIResult   DbInit(void);
  91. DBIResult   DbExit(void);
  92. DBIResult   CreateTable(phDBIDb, phDBICur);
  93. DBIResult   AddRecord(hDBICur, RecordType *, BOOL);
  94. DBIResult   SetDate(pDATE, pCHAR);
  95. DBIResult   GetTable(phDBIDb, phDBICur);
  96. DBIResult   CloseDb(phDBIDb);
  97. DBIResult   GetData(hDBICur, RecordType *);
  98. DBIResult   FillRec(hDBICur, pBYTE, RecordType *);
  99. DBIResult   GoTop(hDBICur, BOOL);
  100. DBIResult   GetNextRec(hDBICur);
  101. DBIResult   GetPrevRec(hDBICur);
  102. DBIResult   GoBottom(hDBICur, BOOL);
  103. DBIResult   SetIndex(phDBICur, UINT16);
  104. DBIResult   DoIndexes(phDBICur, UINT16);
  105. BOOL        AtEOF(hDBICur);
  106. BOOL        AtBOF(hDBICur);
  107. UINT16      GetIndexNum(hDBICur);
  108. DBIResult   DeleteRec(hDBICur);
  109. DBIResult   SetRange(RecordType *, RecordType *, BOOL, BOOL, hDBICur, BOOL,
  110.                      BOOL);
  111. DBIResult   FillBuf(hDBICur, pBYTE, RecordType *);
  112. DBIResult   Search(hDBICur, DBISearchCond, pBYTE);
  113. DBIResult   ResetRange(hDBICur);
  114. DBIResult   DateEncode(UINT16 mon, UINT16 day, UINT16 year, pDATE pTempDate);
  115. void        CreateVchk(UINT16 uNumFields, UINT16 uNumVchks, pFLDDesc fldDesc, pVCHKDesc VchkDesc);
  116.  
  117. // Variables for table creation
  118. extern FLDDesc fldDesc[]; // used in engine.c
  119. extern const UINT16 uNumFields; // used in engine.c
  120. extern IDXDesc idxDesc[]; // used in engine.c
  121. extern const UINT16 uNumIndexes; // used in engine.c
  122. extern const UINT16 uNumRecs;  // Number of records to insert
  123. extern const pCHAR IndexList[]; // Index descriptions for the index listbox
  124. extern const UINT16 uNumVchks;
  125. extern VCHKDesc VchkDesc[];
  126.  
  127. // The name of the table to use and the directory of where to put it.
  128. extern const char far szTblName[];
  129. extern char far szTblDirectory[];
  130. extern char far szPrivDirectory[];
  131. extern const char far szTblType[];
  132.  
  133. // Macro for Subclassing the edit control.
  134. #define SubClassWindow(hWnd, lpfn) \
  135.         ((WNDPROC)SetWindowLong((hWnd), GWL_WNDPROC, \
  136.         (LPARAM)(WNDPROC)(lpfn)))
  137.