home *** CD-ROM | disk | FTP | other *** search
/ Microsoft Internet Business Development Kit / PRODUCT_CD.iso / sqlsvr / odbcsdk / samples / trnslchk / options.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-12-07  |  7.0 KB  |  242 lines

  1. //*---------------------------------------------------------------------------------
  2. //| ODBC Sample Translation DLL and Tool
  3. //|
  4. //|  This code is furnished on an as-is basis as part of the ODBC SDK and is
  5. //|  intended for example purposes only.
  6. //|
  7. //| Title:    OPTIONS.H
  8. //|
  9. //| Purpose:
  10. //|        This module contains the prototypes, defines, and macros required
  11. //|        for OPTIONS.C.
  12. //|
  13. //*---------------------------------------------------------------------------------
  14. #ifndef OPTIONS_DEFS
  15. #define OPTIONS_DEFS
  16.  
  17.  
  18. #include <windows.h>
  19. #include "sql.h"
  20. #include "sqlext.h"
  21.  
  22. #define VER_CHAR    "02.00.1503\0"
  23. #define VER_NUMBER    02,00,15,03
  24.  
  25. #define IDD_OPTIONS        1000
  26. #define IDD_FILTER        1001   
  27. #define IDD_WARNING        1002
  28.  
  29. #define _FILEBUFF             150
  30. #define _FILEWINBOUND    1000
  31. #define _MAXBUFF            2048
  32. #define _BIGBUFF          30000
  33. #define _SMALLBUFF         160
  34.  
  35.  
  36. //-----  Windows defines and macros  --------------------------------
  37. #ifdef WIN32
  38. #define dCSEG(type) const type
  39. #else
  40. #define dCSEG(type) const type _based(_segname("_CODE"))
  41. #endif
  42.  
  43.  
  44. // Create debugging macros.  DEBUGGING is specified in the make file with
  45. //   the -D flag.
  46. #define VSZFile static char vszFile[]=__FILE__
  47. void WinAssertReal(int exp, LPSTR msg, LPSTR file, int line);
  48.  
  49. #ifdef DEBUGGING
  50. #define WinAssert(exp, msg)                                                            \
  51.             WinAssertReal(exp, msg, vszFile, __LINE__);
  52. #else
  53. #define    WinAssert(exp, msg)
  54. #endif
  55.  
  56. #ifndef WIN32
  57. #ifdef transpec_DEFS
  58. #define EXTFUN                FAR PASCAL
  59. #else
  60. #define EXTFUN                FAR PASCAL __export CALLBACK
  61. #endif
  62. #define INTFUN                FAR PASCAL
  63. #else
  64. #define EXTFUN                _stdcall
  65. #define INTFUN                _stdcall
  66. #endif
  67.  
  68.  
  69. #define BITTEST(bitfield, pos) ((bitfield & (1L << pos)) ? TRUE : FALSE)
  70. #define BITSET(bitfield, pos)  bitfield |= (1L << pos)
  71.  
  72.  
  73. #define GetComboIndex(d, v) SendDlgItemMessage(d, v, CB_GETCURSEL, 0, 0L)
  74. #define GetText(d,v,b)                                                                     \
  75.     {                                                                                            \
  76.     HWND tmphwnd=GetDlgItem(d,v);                                                        \
  77.     SendMessage(tmphwnd, WM_GETTEXT,                                                 \
  78.                     (WORD)SendMessage(tmphwnd, WM_GETTEXTLENGTH, 0, 0L) + 1,    \
  79.                     (LPARAM)(LPSTR)b);                                                    \
  80.     }
  81. #define ReleaseMemory(hMem)                                                                        \
  82.     {                                                                             \
  83.     GlobalUnlock(hMem);                                                           \
  84.     GlobalFree(hMem);                                                             \
  85.     }
  86.  
  87.  
  88. // About box ids
  89. #define  HLP_TRNSLCHK             70          
  90.  
  91. #define    IDB_HELP                    313
  92. #define    IDB_OPTIONS                316
  93. #define    IDT_TRACEFILE            320
  94.  
  95. #define    IDC_TRANENTRY            330
  96. #define     IDT_TRANSLATEDLL        331
  97. #define    IDB_SETDEFAULT            332
  98. #define    IDX_TRACE                333
  99. #define    IDX_CALLDLL                334
  100. #define    IDX_DISPLAY                335
  101. #define    IDB_DONE                    336
  102. #define    IDB_TRACE                337
  103. #define    IDB_TRANSLATE            338
  104. #define    IDB_ABOUT                339
  105. #define    IDB_DELETE                340
  106. #define    IDB_SAVE                    341
  107. #define    IDB_FILTER                342
  108. #define     IDB_CANCEL                343
  109.  
  110.  
  111. #define IDX_BIGINT                350
  112. #define IDX_BINARY                351
  113. #define IDX_BIT                    352
  114. #define IDX_CHAR                    353
  115. #define IDX_DATE                    354
  116. #define IDX_DECIMAL                356
  117. #define IDX_DOUBLE                357
  118. #define IDX_FLOAT                    358
  119. #define IDX_INTEGER                359
  120. #define IDX_LONGVARBINARY        360
  121. #define IDX_LONGVARCHAR            361
  122. #define IDX_NUMERIC                362
  123. #define IDX_REAL                    363
  124. #define IDX_SMALLINT                364
  125. #define IDX_TIME                    365
  126. #define IDX_TIMESTAMP            366
  127. #define IDX_TINYINT                367
  128. #define IDX_VARBINARY            368
  129. #define IDX_VARCHAR                369
  130.  
  131. #define IDX_C_BINARY                380
  132. #define IDX_C_BIT                 381
  133. #define IDX_C_CHAR                382
  134. #define IDX_C_DATE                383
  135. #define IDX_C_DOUBLE              384
  136. #define IDX_C_FLOAT                385
  137. #define IDX_C_LONG                386
  138. #define IDX_C_SHORT                387
  139. #define IDX_C_TIME                388
  140. #define IDX_C_TIMESTAMP            389
  141. #define IDX_C_TINYINT            390
  142.  
  143.  
  144. #define    ESCAPE_KEY                0x1B
  145. #define    USER_ENABLEBUTTONS    (WM_USER + 0x102)
  146. #define  USER_SAVECHANGES        (WM_USER + 0x103)
  147. #define    USER_UPDATEENTRY        (WM_USER + 0x104)
  148. #define    USER_SELCHANGE            (WM_USER + 0x105)
  149.  
  150.  
  151. //------------------------------------------------------------------------
  152. //  Declare global variables
  153. //------------------------------------------------------------------------
  154. extern HINSTANCE hLoadedInst;
  155. extern char OutStr[_MAXBUFF];
  156.  
  157. #ifdef _DCL_OPT_STRS
  158. extern LPSTR szFileTitleTrace;
  159. extern LPSTR szFileTitleBrowse;
  160. extern LPSTR szLogSpec;
  161. extern LPSTR szDLLSpec;
  162. extern LPSTR szNone;
  163. extern LPSTR szInstalled;
  164. extern LPSTR szEmpty;
  165. extern LPSTR szOne;
  166. extern LPSTR szZero;
  167. extern LPSTR szNA;
  168. extern LPSTR szTRANCHK;
  169. extern LPSTR szTRANCHKINI;
  170. extern LPSTR szTRANSECTION;
  171. extern LPSTR szTRANSLATEDLL;
  172. extern LPSTR szTRACEFILE;
  173. extern LPSTR szTRACEOPTION;
  174. extern LPSTR szCALLOPTION;
  175. extern LPSTR szDISPLAYOPTION;
  176. extern LPSTR szCFILTER;
  177. extern LPSTR szSQLFILTER;
  178. extern LPSTR szDEFAULT;
  179. extern LPSTR szTRANCHKOPTIONS;
  180. extern LPSTR szWowLog;
  181. extern LPSTR szDeleteEntry;
  182. extern LPSTR szMustSaveNew;
  183. extern LPSTR szSaveChanges;
  184. extern LPSTR szWinTitle;
  185. extern LPSTR szOutOfMemory;
  186. extern LPSTR szps;
  187. extern LPSTR szpd;
  188. extern LPSTR szpu;
  189. extern LPSTR szplu;
  190. #endif
  191.  
  192.  
  193.  
  194. typedef struct tagOptions {
  195.     char        szEntry[_SMALLBUFF];        // Entry
  196.     char        szFile[_SMALLBUFF];        // Trace file
  197.     char        szDLL[_SMALLBUFF];        // DLL file name
  198.     BOOL        fTrace;                        // TRUE if we want to trace
  199.     BOOL        fCallDLL;                    // TRUE if we want to call a DLL
  200.     BOOL        fDisplay;                    // TRUE if we want to display our dialog
  201.     BOOL        fIsTranChk;                    // TRUE if this in the entry for TRANCHK
  202.     BOOL        fNewEntry;                    // TRUE if entry not in .ini file yet
  203.     BOOL        fWarn;                        // TRUE if we should warn user before unloading DLL's
  204.     UDWORD    SqlFilter;                    // Mask of SQL types
  205.     UDWORD    CFilter;                        // Mask of C types
  206.     } OPTIONS;
  207.  
  208. typedef struct lParamStruct {
  209.     HINSTANCE    hInst;                    // hInstance of the caller
  210.     void FAR *    val;                        // Generic pointer to whatever
  211.     } LPARAMSTRUCT;
  212.  
  213.  
  214. #define NumSqlMasks 19
  215. extern dCSEG(int) SqlMasks[NumSqlMasks];
  216.  
  217. #define NumCMasks 11
  218. extern dCSEG(int) CMasks[NumCMasks];
  219.  
  220.  
  221.  
  222. //------------------------------------------------------------------------
  223. //  Declare function prototypes
  224. //------------------------------------------------------------------------
  225. void     INTFUN DisplayAbout(HWND hwnd, HINSTANCE hInst);
  226. int      EXTFUN AboutWndProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam);
  227. void     INTFUN HandleOptions(HWND hwnd, HINSTANCE hInst, OPTIONS FAR * opt);
  228. int      EXTFUN OptionsWndProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam);
  229. void     INTFUN DisplayFilter(HWND hwnd, HINSTANCE hInst, OPTIONS FAR * opt);
  230. int      EXTFUN FilterWndProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam);
  231. BOOL    INTFUN SaveUserChanges(HWND hDlg, BOOL FAR * fSave, LPSTR szEntry);
  232. void    INTFUN SetIniDefaults(OPTIONS FAR * opt);
  233. void    INTFUN GetIniInfo(OPTIONS FAR * opt, BOOL fUseDefault);
  234. void    INTFUN WriteIniInfo(OPTIONS FAR * opt);
  235. void    INTFUN DeleteIniInfo(OPTIONS FAR * opt);
  236. BOOL     INTFUN GetFileSpec(HWND hwnd, LPSTR szInFile, LPSTR szTitle, LPSTR szFilter, DWORD dwAttrib);
  237. void     INTFUN PopulateEntries(HWND hDlg, int idval, OPTIONS FAR * opt);
  238. void    INTFUN CenterDialog(HWND hdlg);
  239.  
  240.  
  241. #endif
  242.