home *** CD-ROM | disk | FTP | other *** search
/ QBasic & Borland Pascal & C / Delphi5.iso / C / BC_502 / 32INVENT.PAK / INVENTRY.H < prev    next >
Encoding:
C/C++ Source or Header  |  1997-05-06  |  4.8 KB  |  138 lines

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