home *** CD-ROM | disk | FTP | other *** search
- //*---------------------------------------------------------------------------------
- //| ODBC Sample Translation DLL and Tool
- //|
- //| This code is furnished on an as-is basis as part of the ODBC SDK and is
- //| intended for example purposes only.
- //|
- //| Title: OPTIONS.H
- //|
- //| Purpose:
- //| This module contains the prototypes, defines, and macros required
- //| for OPTIONS.C.
- //|
- //*---------------------------------------------------------------------------------
- #ifndef OPTIONS_DEFS
- #define OPTIONS_DEFS
-
-
- #include <windows.h>
- #include "sql.h"
- #include "sqlext.h"
-
- #define VER_CHAR "02.00.1503\0"
- #define VER_NUMBER 02,00,15,03
-
- #define IDD_OPTIONS 1000
- #define IDD_FILTER 1001
- #define IDD_WARNING 1002
-
- #define _FILEBUFF 150
- #define _FILEWINBOUND 1000
- #define _MAXBUFF 2048
- #define _BIGBUFF 30000
- #define _SMALLBUFF 160
-
-
- //----- Windows defines and macros --------------------------------
- #ifdef WIN32
- #define dCSEG(type) const type
- #else
- #define dCSEG(type) const type _based(_segname("_CODE"))
- #endif
-
-
- // Create debugging macros. DEBUGGING is specified in the make file with
- // the -D flag.
- #define VSZFile static char vszFile[]=__FILE__
- void WinAssertReal(int exp, LPSTR msg, LPSTR file, int line);
-
- #ifdef DEBUGGING
- #define WinAssert(exp, msg) \
- WinAssertReal(exp, msg, vszFile, __LINE__);
- #else
- #define WinAssert(exp, msg)
- #endif
-
- #ifndef WIN32
- #ifdef transpec_DEFS
- #define EXTFUN FAR PASCAL
- #else
- #define EXTFUN FAR PASCAL __export CALLBACK
- #endif
- #define INTFUN FAR PASCAL
- #else
- #define EXTFUN _stdcall
- #define INTFUN _stdcall
- #endif
-
-
- #define BITTEST(bitfield, pos) ((bitfield & (1L << pos)) ? TRUE : FALSE)
- #define BITSET(bitfield, pos) bitfield |= (1L << pos)
-
-
- #define GetComboIndex(d, v) SendDlgItemMessage(d, v, CB_GETCURSEL, 0, 0L)
- #define GetText(d,v,b) \
- { \
- HWND tmphwnd=GetDlgItem(d,v); \
- SendMessage(tmphwnd, WM_GETTEXT, \
- (WORD)SendMessage(tmphwnd, WM_GETTEXTLENGTH, 0, 0L) + 1, \
- (LPARAM)(LPSTR)b); \
- }
- #define ReleaseMemory(hMem) \
- { \
- GlobalUnlock(hMem); \
- GlobalFree(hMem); \
- }
-
-
- // About box ids
- #define HLP_TRNSLCHK 70
-
- #define IDB_HELP 313
- #define IDB_OPTIONS 316
- #define IDT_TRACEFILE 320
-
- #define IDC_TRANENTRY 330
- #define IDT_TRANSLATEDLL 331
- #define IDB_SETDEFAULT 332
- #define IDX_TRACE 333
- #define IDX_CALLDLL 334
- #define IDX_DISPLAY 335
- #define IDB_DONE 336
- #define IDB_TRACE 337
- #define IDB_TRANSLATE 338
- #define IDB_ABOUT 339
- #define IDB_DELETE 340
- #define IDB_SAVE 341
- #define IDB_FILTER 342
- #define IDB_CANCEL 343
-
-
- #define IDX_BIGINT 350
- #define IDX_BINARY 351
- #define IDX_BIT 352
- #define IDX_CHAR 353
- #define IDX_DATE 354
- #define IDX_DECIMAL 356
- #define IDX_DOUBLE 357
- #define IDX_FLOAT 358
- #define IDX_INTEGER 359
- #define IDX_LONGVARBINARY 360
- #define IDX_LONGVARCHAR 361
- #define IDX_NUMERIC 362
- #define IDX_REAL 363
- #define IDX_SMALLINT 364
- #define IDX_TIME 365
- #define IDX_TIMESTAMP 366
- #define IDX_TINYINT 367
- #define IDX_VARBINARY 368
- #define IDX_VARCHAR 369
-
- #define IDX_C_BINARY 380
- #define IDX_C_BIT 381
- #define IDX_C_CHAR 382
- #define IDX_C_DATE 383
- #define IDX_C_DOUBLE 384
- #define IDX_C_FLOAT 385
- #define IDX_C_LONG 386
- #define IDX_C_SHORT 387
- #define IDX_C_TIME 388
- #define IDX_C_TIMESTAMP 389
- #define IDX_C_TINYINT 390
-
-
- #define ESCAPE_KEY 0x1B
- #define USER_ENABLEBUTTONS (WM_USER + 0x102)
- #define USER_SAVECHANGES (WM_USER + 0x103)
- #define USER_UPDATEENTRY (WM_USER + 0x104)
- #define USER_SELCHANGE (WM_USER + 0x105)
-
-
- //------------------------------------------------------------------------
- // Declare global variables
- //------------------------------------------------------------------------
- extern HINSTANCE hLoadedInst;
- extern char OutStr[_MAXBUFF];
-
- #ifdef _DCL_OPT_STRS
- extern LPSTR szFileTitleTrace;
- extern LPSTR szFileTitleBrowse;
- extern LPSTR szLogSpec;
- extern LPSTR szDLLSpec;
- extern LPSTR szNone;
- extern LPSTR szInstalled;
- extern LPSTR szEmpty;
- extern LPSTR szOne;
- extern LPSTR szZero;
- extern LPSTR szNA;
- extern LPSTR szTRANCHK;
- extern LPSTR szTRANCHKINI;
- extern LPSTR szTRANSECTION;
- extern LPSTR szTRANSLATEDLL;
- extern LPSTR szTRACEFILE;
- extern LPSTR szTRACEOPTION;
- extern LPSTR szCALLOPTION;
- extern LPSTR szDISPLAYOPTION;
- extern LPSTR szCFILTER;
- extern LPSTR szSQLFILTER;
- extern LPSTR szDEFAULT;
- extern LPSTR szTRANCHKOPTIONS;
- extern LPSTR szWowLog;
- extern LPSTR szDeleteEntry;
- extern LPSTR szMustSaveNew;
- extern LPSTR szSaveChanges;
- extern LPSTR szWinTitle;
- extern LPSTR szOutOfMemory;
- extern LPSTR szps;
- extern LPSTR szpd;
- extern LPSTR szpu;
- extern LPSTR szplu;
- #endif
-
-
-
- typedef struct tagOptions {
- char szEntry[_SMALLBUFF]; // Entry
- char szFile[_SMALLBUFF]; // Trace file
- char szDLL[_SMALLBUFF]; // DLL file name
- BOOL fTrace; // TRUE if we want to trace
- BOOL fCallDLL; // TRUE if we want to call a DLL
- BOOL fDisplay; // TRUE if we want to display our dialog
- BOOL fIsTranChk; // TRUE if this in the entry for TRANCHK
- BOOL fNewEntry; // TRUE if entry not in .ini file yet
- BOOL fWarn; // TRUE if we should warn user before unloading DLL's
- UDWORD SqlFilter; // Mask of SQL types
- UDWORD CFilter; // Mask of C types
- } OPTIONS;
-
- typedef struct lParamStruct {
- HINSTANCE hInst; // hInstance of the caller
- void FAR * val; // Generic pointer to whatever
- } LPARAMSTRUCT;
-
-
- #define NumSqlMasks 19
- extern dCSEG(int) SqlMasks[NumSqlMasks];
-
- #define NumCMasks 11
- extern dCSEG(int) CMasks[NumCMasks];
-
-
-
- //------------------------------------------------------------------------
- // Declare function prototypes
- //------------------------------------------------------------------------
- void INTFUN DisplayAbout(HWND hwnd, HINSTANCE hInst);
- int EXTFUN AboutWndProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam);
- void INTFUN HandleOptions(HWND hwnd, HINSTANCE hInst, OPTIONS FAR * opt);
- int EXTFUN OptionsWndProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam);
- void INTFUN DisplayFilter(HWND hwnd, HINSTANCE hInst, OPTIONS FAR * opt);
- int EXTFUN FilterWndProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam);
- BOOL INTFUN SaveUserChanges(HWND hDlg, BOOL FAR * fSave, LPSTR szEntry);
- void INTFUN SetIniDefaults(OPTIONS FAR * opt);
- void INTFUN GetIniInfo(OPTIONS FAR * opt, BOOL fUseDefault);
- void INTFUN WriteIniInfo(OPTIONS FAR * opt);
- void INTFUN DeleteIniInfo(OPTIONS FAR * opt);
- BOOL INTFUN GetFileSpec(HWND hwnd, LPSTR szInFile, LPSTR szTitle, LPSTR szFilter, DWORD dwAttrib);
- void INTFUN PopulateEntries(HWND hDlg, int idval, OPTIONS FAR * opt);
- void INTFUN CenterDialog(HWND hdlg);
-
-
- #endif
-