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

  1. // BDE - (C) Copyright 1994 by Borland International
  2.  
  3. #ifndef __SNIP_IT_H
  4. #define __SNIP_IT_H
  5.  
  6. // Put all include files in one place to optimize pre-compiled headers
  7. #include <windows.h>
  8. #include <windowsx.h>
  9. #include <stdarg.h>
  10. #include <malloc.h>
  11. #include <stdlib.h>
  12. #include <string.h>
  13. #include <io.h>         // access
  14. #include <stdio.h>      // sprintf
  15. #include <direct.h>     // getcwd
  16. #include <idapi.h>      // Only include needed for IDAPI...
  17.  
  18. #include "id_defs.h"
  19.  
  20. // Define used to break to the debugger
  21. #define BREAK_IN_DEBUGGER()                 _asm int 3;
  22.  
  23. // Define used for Microsoft compilers
  24. #if defined(_MSC_VER)
  25.     #define farmalloc(parm) _fmalloc(parm)
  26.     #define farfree(parm) _ffree(parm)
  27.     // Leave it blank on purpose as VC++ minds having far declared.
  28.     #define SNIPFAR 
  29. #endif                                                             
  30.  
  31. #if defined(__TURBOC__) && defined(_Windows)
  32.     #define SNIPFAR far
  33. #endif
  34.  
  35. // General defines
  36. #define NUM_RESOURCES           13
  37. #define SUCCESS                 1
  38. #define FAILURE                 0
  39. #define GOOD_STR_COMPARE        0
  40. #define BASE_MIN_WIDTH          320
  41. #define BASE_MIN_HEIGHT         226
  42. #define MAX_VIEW_CODE_MODULES   100
  43.  
  44. // These definitions help us to paint the screen
  45. typedef enum
  46. {
  47.     resBUTTON       = 0,
  48.     resCOMBOBOX     = 1,
  49.     resEDIT         = 2,
  50.     resEDIT64       = 3,
  51.     resGROUP        = 4,
  52.     resLISTBOX      = 5,
  53.     resSTATIC       = 6,
  54.     resSHADE        = 7
  55. } TypeRes;
  56.  
  57. typedef struct
  58. {
  59.     TypeRes Res;
  60.     int     Id;
  61.     char    Text[80];
  62.     int     X1, Y1;
  63.     int     X2, Y2;
  64.     DWORD   Attrib;
  65.     BOOL    Resize;
  66. } ResStruct;
  67.  
  68. // These defines are used during search_text()
  69. typedef struct
  70. {
  71.     pCHAR   pText;
  72.     pCHAR   pLastSearch;
  73.     pCHAR   pSearchStr;
  74.     BOOL    bCaseSens, bCancelPressed;
  75. } SrchStruct;
  76.  
  77. // Defines related to WinMsg() input parameters
  78. #define MSG_INFO            0   // Message box styles...
  79. #define MSG_STOP            1
  80. #define MSG_QUESTION            2
  81. #define MSG_EXCLAMATION         3
  82. #define BTN_OK              4   // Button styles...
  83. #define BTN_YES_NO          5
  84. #define BTN_OK_CANCEL           6
  85. #define BTN_RETRY_CANCEL        7
  86. #define BTN_YES_NO_CANCEL       8
  87.  
  88. // Global data 
  89. extern HINSTANCE    hInst;
  90. extern RECT         DeskRect;
  91. extern pCHAR        GlobBuf;
  92. extern ResStruct    MainRes[];
  93. extern HWND         hMainWnd, hViewEdit, hDescEdit;
  94. extern INT16        DialogWidthUnits, DialogHeightUnits, MinHeight, MinWidth;
  95. extern WNDPROC      fpStdEditBoxProc, fnTabEditBox[];
  96. extern SrchStruct   Search;
  97.  
  98. // Directory in which the tables exist. Full path name will be generated
  99. //   by the application
  100. extern char far szTblDirectory[];
  101. extern char far szPrivDirectory[];
  102.  
  103. // IDAPI specific data
  104. extern hDBIDb       SnipItDb;
  105.  
  106. // Structure used to define input array information 
  107. typedef struct
  108. {
  109.     pCHAR   pCodeName;
  110.     void    (*pFunc)(void);
  111.     pCHAR   pSourceFile;
  112.     UINT16  CodeDescId;
  113. } VIEW_INPUT;
  114. extern VIEW_INPUT  far InputData[];
  115.  
  116. // Function prototypes for SNIPTOOL.C 
  117. void Screen(pCHAR Format, ...);
  118. DBIResult ChkRslt(DBIResult rslt, pCHAR pMsg);
  119. INT16 WinMsg(pCHAR pMsg, INT16 TypeMsg, INT16 TypeBtn);
  120. DBIResult InitAndConnect(phDBIDb phDb);
  121. DBIResult InitAndConnect2(phDBIDb phDb);
  122. DBIResult CloseDbAndExit(phDBIDb phDb);
  123. DBIResult FillTable(hDBIDb hDb, pCHAR TblName, pCHAR TblType,
  124.                        FLOAT NumRecs);
  125. DBIResult CreateAndFillTable(hDBIDb hDb, pCRTblDesc pTblDesc, FLOAT NumRecs,
  126.                              phDBICur phCur);      
  127. DBIResult DisplayInMemoryTable(hDBICur hCur, UINT32 uDisplayNRecs);
  128. DBIResult DisplayTable(hDBICur hCur, UINT32 uDisplayNRecs);
  129. int MakeFullPath(pCHAR pszDirectory, pCHAR pszRelativeDirectory);
  130. DBIResult DisplayNextRecord(hDBICur hCur);
  131. DBIResult DisplayCurrentRecord(hDBICur hCur);
  132. DBIResult PutFieldSample(hDBICur hCur, pBYTE pRecBuf,
  133.                          UINT16 FldNum, pFLDDesc pfldDesc);
  134. DBIResult SetupFields(CURProps TblProps, pFLDDesc pFldDescs,
  135.                       CHAR** pszField, UINT16 uDefLength);
  136. DBIResult GetFields(hDBICur hCur, pFLDDesc pFldDescs,
  137.                     pBYTE pRecBuf, CHAR** pszField,
  138.                     UINT16 uDefLength);
  139. DBIResult FormatDate(DATE Date, pCHAR szDate);
  140. DBIResult FormatTime(TIME Time, pCHAR szDate);
  141. DBIResult FormatTimeStamp(TIMESTAMP TimeStamp, pCHAR szTime);
  142. DBIResult FormatNumber(pCHAR szNumber);
  143.  
  144. // Function prototypes for SNIPUTIL.C
  145. INT16 get_array_offset(void);
  146. void yield_control(void);
  147. void clear_multi_line_edit_box(HWND hWnd, INT16 EditId);
  148. void fill_in_description(void);
  149. void run_sample_code(void);
  150. void view_sample_code(void);
  151.  
  152. // Function prototypes for exported functions
  153. long FAR PASCAL _export MainWndProc(HWND, UINT, UINT, LONG);
  154. BOOL FAR PASCAL _export AboutDlgProc(HWND, WORD, WORD, LONG);
  155. BOOL FAR PASCAL _export ConnectDlgProc(HWND, WORD, WORD, LONG);
  156. BOOL FAR PASCAL _export SearchDlgProc(HWND, WORD, WORD, LONG);
  157. long FAR PASCAL _export TabEditBox(HWND, UINT, WORD, LONG);
  158.  
  159. // Function prototypes for SNIPMAIN.C
  160. INT16 get_array_offset(void);
  161. void yield_control(void);
  162. void clear_multi_line_edit_box(HWND hWnd, INT16 EditId);
  163. void fill_in_description(void);
  164. void run_sample_code(void);
  165. void view_sample_code(void);
  166. void search_text(HWND hWnd, BOOL bSearchFirst);
  167. char * StrStr(pCHAR pSourceString, pCHAR pSearchString);
  168. BOOL CaseInsensitiveCompare(CHAR Char1, CHAR Char2);
  169. void resize_resources(int MainWidth, int MainHeight);
  170. FARPROC setup_tab_edit_box(HWND hWnd, int EditId);
  171. void reset_connect_dialog(HWND hWnd, BOOL bResetAll);
  172. LRESULT SendMsg(int Id, UINT Msg, WPARAM wParam, LPARAM lParam);
  173.  
  174. #endif
  175.