// BDE - (C) Copyright 1994 by Borland International #ifndef __SNIP_IT_H #define __SNIP_IT_H // Put all include files in one place to optimize pre-compiled headers #include #include #include #include #include #include #include // access #include // sprintf #include // getcwd #include // Only include needed for IDAPI... #include "id_defs.h" // Define used to break to the debugger #define BREAK_IN_DEBUGGER() _asm int 3; // Define used for Microsoft compilers #if defined(_MSC_VER) #define farmalloc(parm) _fmalloc(parm) #define farfree(parm) _ffree(parm) // Leave it blank on purpose as VC++ minds having far declared. #define SNIPFAR #endif #if defined(__TURBOC__) && defined(_Windows) #define SNIPFAR far #endif // General defines #define NUM_RESOURCES 13 #define SUCCESS 1 #define FAILURE 0 #define GOOD_STR_COMPARE 0 #define BASE_MIN_WIDTH 320 #define BASE_MIN_HEIGHT 226 #define MAX_VIEW_CODE_MODULES 100 // These definitions help us to paint the screen typedef enum { resBUTTON = 0, resCOMBOBOX = 1, resEDIT = 2, resEDIT64 = 3, resGROUP = 4, resLISTBOX = 5, resSTATIC = 6, resSHADE = 7 } TypeRes; typedef struct { TypeRes Res; int Id; char Text[80]; int X1, Y1; int X2, Y2; DWORD Attrib; BOOL Resize; } ResStruct; // These defines are used during search_text() typedef struct { pCHAR pText; pCHAR pLastSearch; pCHAR pSearchStr; BOOL bCaseSens, bCancelPressed; } SrchStruct; // Defines related to WinMsg() input parameters #define MSG_INFO 0 // Message box styles... #define MSG_STOP 1 #define MSG_QUESTION 2 #define MSG_EXCLAMATION 3 #define BTN_OK 4 // Button styles... #define BTN_YES_NO 5 #define BTN_OK_CANCEL 6 #define BTN_RETRY_CANCEL 7 #define BTN_YES_NO_CANCEL 8 // Global data extern HINSTANCE hInst; extern RECT DeskRect; extern pCHAR GlobBuf; extern ResStruct MainRes[]; extern HWND hMainWnd, hViewEdit, hDescEdit; extern INT16 DialogWidthUnits, DialogHeightUnits, MinHeight, MinWidth; extern WNDPROC fpStdEditBoxProc, fnTabEditBox[]; extern SrchStruct Search; // Directory in which the tables exist. Full path name will be generated // by the application extern char far szTblDirectory[]; extern char far szPrivDirectory[]; // IDAPI specific data extern hDBIDb SnipItDb; // Structure used to define input array information typedef struct { pCHAR pCodeName; void (*pFunc)(void); pCHAR pSourceFile; UINT16 CodeDescId; } VIEW_INPUT; extern VIEW_INPUT far InputData[]; // Function prototypes for SNIPTOOL.C void Screen(pCHAR Format, ...); DBIResult ChkRslt(DBIResult rslt, pCHAR pMsg); INT16 WinMsg(pCHAR pMsg, INT16 TypeMsg, INT16 TypeBtn); DBIResult InitAndConnect(phDBIDb phDb); DBIResult InitAndConnect2(phDBIDb phDb); DBIResult CloseDbAndExit(phDBIDb phDb); DBIResult FillTable(hDBIDb hDb, pCHAR TblName, pCHAR TblType, FLOAT NumRecs); DBIResult CreateAndFillTable(hDBIDb hDb, pCRTblDesc pTblDesc, FLOAT NumRecs, phDBICur phCur); DBIResult DisplayInMemoryTable(hDBICur hCur, UINT32 uDisplayNRecs); DBIResult DisplayTable(hDBICur hCur, UINT32 uDisplayNRecs); int MakeFullPath(pCHAR pszDirectory, pCHAR pszRelativeDirectory); DBIResult DisplayNextRecord(hDBICur hCur); DBIResult DisplayCurrentRecord(hDBICur hCur); DBIResult PutFieldSample(hDBICur hCur, pBYTE pRecBuf, UINT16 FldNum, pFLDDesc pfldDesc); DBIResult SetupFields(CURProps TblProps, pFLDDesc pFldDescs, CHAR** pszField, UINT16 uDefLength); DBIResult GetFields(hDBICur hCur, pFLDDesc pFldDescs, pBYTE pRecBuf, CHAR** pszField, UINT16 uDefLength); DBIResult FormatDate(DATE Date, pCHAR szDate); DBIResult FormatTime(TIME Time, pCHAR szDate); DBIResult FormatTimeStamp(TIMESTAMP TimeStamp, pCHAR szTime); DBIResult FormatNumber(pCHAR szNumber); // Function prototypes for SNIPUTIL.C INT16 get_array_offset(void); void yield_control(void); void clear_multi_line_edit_box(HWND hWnd, INT16 EditId); void fill_in_description(void); void run_sample_code(void); void view_sample_code(void); // Function prototypes for exported functions long FAR PASCAL _export MainWndProc(HWND, UINT, UINT, LONG); BOOL FAR PASCAL _export AboutDlgProc(HWND, WORD, WORD, LONG); BOOL FAR PASCAL _export ConnectDlgProc(HWND, WORD, WORD, LONG); BOOL FAR PASCAL _export SearchDlgProc(HWND, WORD, WORD, LONG); long FAR PASCAL _export TabEditBox(HWND, UINT, WORD, LONG); // Function prototypes for SNIPMAIN.C INT16 get_array_offset(void); void yield_control(void); void clear_multi_line_edit_box(HWND hWnd, INT16 EditId); void fill_in_description(void); void run_sample_code(void); void view_sample_code(void); void search_text(HWND hWnd, BOOL bSearchFirst); char * StrStr(pCHAR pSourceString, pCHAR pSearchString); BOOL CaseInsensitiveCompare(CHAR Char1, CHAR Char2); void resize_resources(int MainWidth, int MainHeight); FARPROC setup_tab_edit_box(HWND hWnd, int EditId); void reset_connect_dialog(HWND hWnd, BOOL bResetAll); LRESULT SendMsg(int Id, UINT Msg, WPARAM wParam, LPARAM lParam); #endif