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

  1. //*---------------------------------------------------------------------------------
  2. //|  ODBC System Administrator
  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:    STANDARD.H
  8. //|        This module contains standard includes which are required by many modules.
  9. //|            This include file is not specific for any tool.
  10. //|    Notes:
  11. //|        1) If using this file for a DLL, #define STANDARD_DLL, otherwise it is
  12. //|                assumed that it is being used for a Windows application.
  13. //*---------------------------------------------------------------------------------
  14. #ifndef STANDARD_DEFS
  15. #define STANDARD_DEFS
  16.  
  17. #include <windows.h>
  18. #include "sql.h"
  19. #include "sqlext.h"
  20. #include "w16macro.h"
  21.  
  22.  
  23. //----------------------------------------------------------------------------------
  24. //        Defines and macros
  25. //----------------------------------------------------------------------------------
  26. #define TEMP_SIZE        50
  27. #define MAX_BUFF        1000
  28. #define    MAXBUFF                256
  29. #define    MAXFILEBUFF            32000
  30. #define    DFTBUFFSIZE            30
  31. #define    LARGEBUFF            65535
  32.  
  33. //
  34. // When calling ODBC functions, you should allow for the case where 
  35. //    SQL_SUCCESS_WITH_INFO was returned.  Unless you want to see the informational
  36. // SQL state, you should treat these as the same.  The following macros are
  37. //    handy to do just that.
  38. //
  39. #define RC_SUCCESSFUL(rc)    (rc == SQL_SUCCESS || rc == SQL_SUCCESS_WITH_INFO)
  40. #define RC_NOTSUCCESSFUL(rc) (!(RC_SUCCESSFUL(rc)))
  41.  
  42. //
  43. // Win 3.x specific items
  44. //
  45. #ifndef WIN32
  46.  
  47. #define INTFUN FAR PASCAL
  48. #define EXTFUN FAR PASCAL __export
  49. #define dCSEG(type) const type _based(_segname("_CODE"))
  50.  
  51. //
  52. // 32-bit stuff
  53. //
  54. #else
  55. #define MoveTo(hdc, x, y)            MoveToEx(hdc, x, y, NULL)
  56. #define dCSEG(type) const type
  57. #define INTFUN WINAPI
  58. #define EXTFUN WINAPI
  59.  
  60. #define WRITE        OF_WRITE
  61. #define READ        OF_READ
  62. #endif
  63.  
  64.  
  65.  
  66. #ifdef WIN32
  67. #else
  68. #endif
  69. #define VSZFile static char vszFile[]=__FILE__;
  70.  
  71. #ifdef _DEBUG
  72. #define DEBUGMSG(msg) OutputDebugString((LPSTR)msg)
  73. #else
  74. #define DEBUGMSG(msg)
  75. #endif
  76.  
  77.  
  78. #ifdef _DEBUG
  79. void FAR * DebugGetMemory(DWORD size, LPSTR szFile, int cbLine);
  80. void DebugReleaseMemory(LPVOID ptr, LPSTR szFile, int cbLine);
  81. void WinAssertReal(int exp, LPSTR msg, LPSTR file, int line);
  82.  
  83. #define WinAssert(exp, msg)                                                            \
  84.             WinAssertReal(exp, msg, vszFile, __LINE__);
  85. #define GetMemory(size) DebugGetMemory(size, vszFile, __LINE__)
  86. #define ReleaseMemory(size) DebugReleaseMemory(size, vszFile, __LINE__)
  87. #define DEBUGADDR(title, hwnd, ptr)                                                                                                \
  88.     {                                                                                                     \
  89.     static char szTmp[100];                                                                               \
  90.     wsprintf(szTmp, "%s, hwnd: %04X, ptr: %04X:%04X", (LPSTR)title, hwnd, HIWORD(ptr), LOWORD(ptr));      \
  91.     DEBUGMSG(szTmp);                                                                                      \
  92.     }
  93. #else
  94. #define    WinAssert(exp, msg)
  95. #define GetMemory(size) DoGetMemory(size)
  96. #define ReleaseMemory(size) DoReleaseMemory(size)
  97. #define DEBUGADDR(p1,p2,p3)
  98. #endif
  99.  
  100. #define NumItems(s) (sizeof (s) / sizeof(s[0]))
  101.  
  102. #define ABS(val) ((val < 0) ? (val * -1) : (val))
  103.  
  104. //*---------------------------------------------------------------------------------
  105. //|    Global variables
  106. //*---------------------------------------------------------------------------------
  107. dCSEG(char) szui[];
  108. dCSEG(char) szEmpty[];
  109.  
  110. //*---------------------------------------------------------------------------------
  111. //|    Function prototypes
  112. //*---------------------------------------------------------------------------------
  113. void FAR * DoGetMemory(DWORD size);
  114. void DoReleaseMemory(LPVOID ptr);
  115. void RemoveCrLf(LPSTR instr);
  116. void GetNewDirectory(LPSTR outstr, LPSTR instr);
  117. BOOL ValidName(LPSTR instr);
  118. int lpatoi(LPSTR instr);
  119.  
  120. LPSTR EXTFUN GetidsString(UINT ids, LPSTR szOut, UINT cbSize);
  121. VOID FAR CDECL szWrite(HWND hwnd, LPSTR szFmt, ...);
  122. int FAR CDECL szMessageBox(HWND hwnd, UINT style, LPSTR szTitle, LPSTR szFmt, ...);
  123.  
  124.  
  125. #endif
  126.