home *** CD-ROM | disk | FTP | other *** search
- // Borland C++ - (C) Copyright 1994 by Borland International
-
- #include <windows.h>
- #include <ctl3d.h>
- #include <idapi.h>
- #include <string.h>
- #include <io.h>
- #include <dos.h> // for date structure and getdate function
- #include <malloc.h> // malloc
- #include <stdio.h>
- #include <stdlib.h> // atoi
- #include <direct.h>
- #include <errno.h>
- #include "id_defs.h"
- #include "macro.h"
-
- // Definitions needed for engine.c
- #define IDLENGTH 6
- #define FLDLENGTH 50
- #define FLTLENGTH 20
- #define DATELEN 14
- #define COMMENTLEN 300
-
- #define TOP 0
- #define BOTTOM 2
- #define PREV_REC -1
- #define NEXT_REC 1
- #define RANGEERROR 2
-
-
- // Externs for global data
- extern HINSTANCE hInst;
- extern HWND hMainWnd;
- extern HWND hErrorWnd;
- extern BOOL NewRecMode;
- extern BOOL RangeSet;
- extern WNDPROC _wpOrigWndProc;
- extern char szNoneOnOrder[];
-
- // Variables for ENGINE.C
- typedef struct {
- CHAR ItemId[IDLENGTH];
- CHAR Building[FLDLENGTH];
- CHAR Item[FLDLENGTH];
- CHAR In_Stock[FLTLENGTH];
- CHAR Cost[FLTLENGTH];
- CHAR DateD[DATELEN];
- CHAR Message[COMMENTLEN];
- } RecordType;
-
- // Function prototypes for INV_MAIN.C
- long FAR _pascal _export MainDlgProc (HWND, UINT, WPARAM, LPARAM);
- BOOL InitApp(int nCmdShow);
- long FAR _pascal _export EditSubClassProc(HWND, WORD, WORD, LONG);
- BOOL FAR _pascal _export AboutDlg(HWND, WORD, WORD, LONG);
- BOOL FAR _pascal _export OrderDlg(HWND, WORD, WORD, LONG);
- BOOL FAR _pascal _export RangeDlg(HWND, WORD, WORD, LONG);
- BOOL FAR _pascal _export SearchDlg(HWND, WORD, WORD, LONG);
- BOOL FillStruct(RecordType *, UINT16);
- BOOL DisplayTable(hDBICur);
- BOOL TableExist(pCHAR);
- BOOL FillTable(hDBICur, phDBIDb);
- BOOL DispRec(RecordType *);
- void MoveRec (hDBICur, INT16);
- void CheckButtons(hDBICur);
- void SetupEdits(void);
- BOOL SaveRec(hDBICur, BOOL);
- BOOL GetRec(RecordType *);
- BOOL DeleteRecord(hDBICur);
- void SetControl(UINT16, BOOL);
- UINT16 FillDropList (HWND, hDBICur, UINT16);
- void SetItemFocus(void);
- BOOL ClearDlg(void);
- BOOL verified(void);
- BOOL CanContinue(pCHAR, UINT16);
- void EndNewRec(hDBICur);
- void SetDefaultDate(void);
- void FillFieldList(HWND);
- void GetField(RecordType *, pCHAR, UINT16);
- void PutField(RecordType *, pCHAR, UINT16);
- void SetFieldLength(HWND, UINT16, UINT16, UINT16, BOOL);
- UINT16 GetCond(HWND);
-
- // Function prototypes for INV_UTIL.C
- UINT16 WinMsg(pCHAR, UINT16, UINT16);
- void ChangeEntryMode(void);
- int MakeFullPath(pCHAR pszDirectory, pCHAR pszRelativeDirectory);
-
- // Functions for ENGINE.C
- DBIResult DbInit(void);
- DBIResult DbExit(void);
- DBIResult CreateTable(phDBIDb, phDBICur);
- DBIResult AddRecord(hDBICur, RecordType *, BOOL);
- DBIResult SetDate(pDATE, pCHAR);
- DBIResult GetTable(phDBIDb, phDBICur);
- DBIResult CloseDb(phDBIDb);
- DBIResult GetData(hDBICur, RecordType *);
- DBIResult FillRec(hDBICur, pBYTE, RecordType *);
- DBIResult GoTop(hDBICur, BOOL);
- DBIResult GetNextRec(hDBICur);
- DBIResult GetPrevRec(hDBICur);
- DBIResult GoBottom(hDBICur, BOOL);
- DBIResult SetIndex(phDBICur, UINT16);
- DBIResult DoIndexes(phDBICur, UINT16);
- BOOL AtEOF(hDBICur);
- BOOL AtBOF(hDBICur);
- UINT16 GetIndexNum(hDBICur);
- DBIResult DeleteRec(hDBICur);
- DBIResult SetRange(RecordType *, RecordType *, BOOL, BOOL, hDBICur, BOOL,
- BOOL);
- DBIResult FillBuf(hDBICur, pBYTE, RecordType *);
- DBIResult Search(hDBICur, DBISearchCond, pBYTE);
- DBIResult ResetRange(hDBICur);
- DBIResult DateEncode(UINT16 mon, UINT16 day, UINT16 year, pDATE pTempDate);
- void CreateVchk(UINT16 uNumFields, UINT16 uNumVchks, pFLDDesc fldDesc, pVCHKDesc VchkDesc);
-
- // Variables for table creation
- extern FLDDesc fldDesc[]; // used in engine.c
- extern const UINT16 uNumFields; // used in engine.c
- extern IDXDesc idxDesc[]; // used in engine.c
- extern const UINT16 uNumIndexes; // used in engine.c
- extern const UINT16 uNumRecs; // Number of records to insert
- extern const pCHAR IndexList[]; // Index descriptions for the index listbox
- extern const UINT16 uNumVchks;
- extern VCHKDesc VchkDesc[];
-
- // The name of the table to use and the directory of where to put it.
- extern const char far szTblName[];
- extern char far szTblDirectory[];
- extern char far szPrivDirectory[];
- extern const char far szTblType[];
-
- // Macro for Subclassing the edit control.
- #define SubClassWindow(hWnd, lpfn) \
- ((WNDPROC)SetWindowLong((hWnd), GWL_WNDPROC, \
- (LPARAM)(WNDPROC)(lpfn)))
-