home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / sdk / dbmsg / oledb / qurydemo / qurydemo.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-03-12  |  16.5 KB  |  446 lines

  1. //-----------------------------------------------------------------------------
  2. // Microsoft OLE DB Main Include File
  3. // Copyright (C) 1995-1998 Microsoft Corporation
  4. //
  5. // @doc
  6. //
  7. // @module main include file
  8. //
  9. //-----------------------------------------------------------------------------
  10.  
  11. #ifdef RC_INVOKED
  12. #define ID(id) id
  13. #else
  14. #define ID(id) MAKEINTRESOURCE(id)
  15. #endif
  16.  
  17. /* Resource Identifiers */
  18. #define BMP_NEWQUERY        ID(10)    // new window button bitmap
  19. #define BMP_RUNQUERY        ID(20)    // exec query button bitmap
  20. #define    APPICON                ID(30)    // application icon
  21. #define QUERYWINDOWICON        ID(40)    // MDI Child window icon
  22. #define QURYDEMOMENU        ID(50)    // Application menu
  23. #define INITDIALOG            ID(60)    // connect modal dialog box
  24. #define DISCONNECTDIALOG    ID(70)    // disconnect modal dialog box
  25. #define ABOUTDIALOG            ID(80)    // about modal dialog box
  26. #define MDICHILDDIALOG        ID(90)    // MDI Child modeless dialog box
  27. #define APPACCELERATOR        ID(100)    // Accelerator table for the app
  28.  
  29. /* Menu Identifiers */
  30. #define IDM_POPUPAPPSYS        10        // Placeholder, used by status bar
  31. #define IDM_POPUPMDISYS        20        // Placeholder, used by status bar
  32. #define IDM_POPUPLOGIN        100        // Placeholder, used by status bar
  33. #define IDM_INITIALIZE        110
  34. #define IDM_DISCONNECT        120    
  35. #define IDM_EXIT            130
  36. #define IDM_POPUPQUERY        140        // Placeholder, used by status bar
  37. #define IDM_QUERY            150
  38. #define IDM_NEW                160
  39. #define IDM_POPUPSCHEMA        170     // Placeholder, used by status bar
  40.  
  41.  
  42. #define IDM_POPUPWINDOW        210     // Placeholder, used by status bar
  43. #define IDM_TILE            220
  44. #define IDM_CASCADE            230
  45. #define IDM_ICONS            240
  46. #define IDM_CLOSEALL        250
  47. #define IDM_POPUPHELP        260        // Placeholder, used by status bar
  48. #define IDM_APPHELP            270
  49. #define IDM_ABOUT            280
  50. #define IDM_MDICHILD        290
  51.  
  52.  
  53. #define    IDM_ASSERTIONS                300
  54. #define IDM_CATALOGS                310
  55. #define IDM_CHARACTER_SETS            320
  56. #define IDM_CHECK_CONSTRAINTS        330
  57. #define IDM_COLLATIONS                340
  58. #define IDM_COLUMN_DOMAIN_USAGE        350
  59. #define IDM_COLUMN_PRIVILEGES        360
  60. #define IDM_COLUMNS                    370
  61. #define IDM_CONSTRAINT_COLUMN_USAGE 380
  62. #define IDM_CONSTRAINT_TABLE_USAGE  390
  63. #define IDM_FOREIGN_KEYS            400
  64. #define IDM_INDEXES                    410
  65. #define IDM_KEY_COLUMN_USAGE        420
  66. #define IDM_PRIMARY_KEYS            430
  67. #define IDM_PROCEDURE_COLUMNS        440
  68. #define IDM_PROCEDURE_PARAMETERS    450
  69. #define IDM_PROCEDURES                460
  70. #define IDM_PROVIDER_TYPES            470
  71. #define IDM_REFERENTIAL_CONSTRAINTS    480
  72. #define IDM_SCHEMATA                490
  73. #define IDM_SQL_LANGUAGES            500
  74. #define IDM_STATISTICS                510
  75. #define IDM_TABLE_CONSTRAINTS        520
  76. #define IDM_TABLE_PRIVILEGES        530
  77. #define IDM_TABLES                    540
  78. #define IDM_TRANSLATIONS            550
  79. #define IDM_USAGE_PRIVILEGES        560
  80. #define IDM_VIEW_COLUMN_USAGE        570
  81. #define IDM_VIEW_TABLE_USAGE        580
  82. #define IDM_VIEWS                    590  //ADDED
  83.  
  84. /* child window ids */
  85. #define IDW_TOOLBAR            10
  86. #define IDW_STATUSBAR        20
  87. #define IDW_MDICLIENT        30
  88.  
  89. #define IDW_CRSRLIST        10        // toolbar comboboxes
  90. #define IDW_COMMANDLIST        20
  91.  
  92. #define IDCOMBO_PROVIDER    10        // connect dialog box controls
  93. #define IDCOMBO_NAME        20
  94. #define IDTEXT_USERID        30
  95. #define IDTEXT_PASSWORD        40
  96. #define IDCOMBO_PROMPT        45
  97. #define IDENUM              50
  98.  
  99. #define IDLIST_SESSION        10        // disconnect dialog box controls
  100. #define IDLIST_COMMAND        20
  101. #define IDCLOSE_ACTVTY        30
  102. #define IDDISCONNECT        40
  103. #define IDICON_WARN            50
  104.  
  105. #define IDTEXT_PRMPT        10        // MDI child's modeless dialog controls
  106. #define IDTEXT_SQL            20
  107. #define IDLIST_RSLT            30
  108.  
  109. /* MDI Child Window Offsets */
  110. #define CBWNDEXTRA            4        // storage in MDI Child Window
  111. #define GWLAPP_HDLG            0        // child dialog handle
  112.  
  113. /* Other Constants */
  114. #define MAXCHILDWNDS        10                        //maximum child windows allowed
  115. #define MAXBUFLEN            256                        //display buffer size
  116. #define MAX_COL                35                        //maximum column in result set
  117. #define MAX_ROW                100                        //maximum number of rows
  118. #define MAXDATALEN            25                        //maximum data length per column
  119. #define MAXCOLNAMELEN        20
  120. #define MAXCOLNDATALENGTH   23
  121. #define MAXDISPLAYSIZE        MAX_COL*(MAXDATALEN+1)
  122. #define    MINWIDTH            415                        //minimum width of app window
  123. #define    MINHEIGHT            350                        //minimum height of app window
  124. #define LISTTABSTOP            100                        //tabstop in the display listbox
  125. #define LISTHORZSCROLL        (LISTTABSTOP*2)            //horizontal scroll for the listbox
  126. #define LISTHORZEXT            0                        //horizontal extent inthe list box
  127. #define WINDOWMENUPLACE        2                        //Window menu place for adding MDI child windows
  128. #define IDT_STATUSTIMER        1                        //timer id
  129. #define TIMERDELAY            60000                    //timer duration
  130. #define BTTNX                345                        //first toolbar button location
  131. #define BTTNY                2                        //button y position
  132. #define    BTTNWIDTH            25                      //button width
  133. #define BTTNHEIGHT            23                      //button height
  134. #define BTTNMARGIN            5                        //distance between toolbar buttons
  135. #define TOOLBARMARGINY        5                        //fixed margin w/o combobox height
  136. #define STATUSBARMARGINY    8                        //fixed margin w/o textbox height
  137.  
  138. /* String Constants */
  139. #define POPUPLOGIN            "&Login"
  140. #define MENUITEMCONNECT        "&Connect... \aCtrl+C"
  141. #define MENUITEMDISCONNECT    "&Unitialize... \aCtrl+U"
  142. #define    MENUITEMEXIT        "E&xit"
  143. #define POPUPQUERY            "&Command"
  144. #define MENUITEMQUERY        "&Execute Command Text \aCtrl+E"
  145. #define MENUITEMNEW            "&New Command \aCtrl+N"
  146. #define POPUPSCHEMA            "&Schema \aCtrl+S"
  147. #define MENUITEMTYPES        "&PROVIDER_TYPES \aCtrl+P"
  148. #define    MENUITEMTABLES        "T&ABLES \aCtrl+A"
  149. #define MENUITEMCOLUMNS        "&COLUMNS \aCtrl+C"
  150. #define POPUPWINDOW            "&Window"
  151. #define MENUITEMTILE        "&Tile"
  152. #define    MENUITEMCASCADE        "&Cascade"
  153. #define MENUITEMICONS        "Arrange &Icons"
  154. #define    MENUITEMCLOSEALL    "Close &All"
  155. #define POPUPHELP            "&Help"
  156. #define MENUITEMAPPHELP        "&Help on Qurydemo \aF1"
  157. #define    MENUITEMABOUT        "&About Qurydemo..."
  158.  
  159. #define OLEDBFRAMECLASS        "QDEMO32MAIN"
  160.  
  161. #define OLEDBTOOLCLASS        "QDEMOTool"
  162. #define OLEDBSTATUSCLASS    "QDEMOStatus"
  163. #define OLEDBMDICLASS        "QDEMOMDI"
  164. #define COMBOBOXCLASS        "COMBOBOX"
  165. #define MDICLIENTCLASS        "MDICLIENT"
  166. #define UNTITLED            "Untitled"
  167. #define APPTITLE            "Microsoft OLE DB Sample Query Program"
  168. #define    EXECERROR            "Execution Error"
  169. #define INITERROR            "Failed to initialize Session interface"
  170. #define CLASSERROR            "Failed to register application class"
  171. #define CREATEMAINERR        "Failed to create application main window"
  172. #define CREATECHILDERR        "Failed to create a new Command"
  173. #define ALPHABETS            "abcdefghijklmnopqrstuvwxyz"
  174. #define TIMETEXT            "MM:MM MM"
  175. #define DATETEXT            "MMM-MM"
  176. #define TIMEFORMAT            " %I:%M %p"
  177. #define DATEFORMAT            " %b-%d"
  178. #define NOPROVIDERERR        "Please provide a Data Source"
  179. #define MOREINFO            "Incomplete Information"
  180.  
  181. #define STATUSPOPUPAPPSYS   " Control menu for the application "
  182. #define STATUSPOPUPMDISYS    " Control menu for the window "
  183. #define STATUSRESTORE       " Restore window to normal "
  184. #define STATUSMOVE          " Move window "
  185. #define STATUSSIZE          " Size window "
  186. #define STATUSMINIMIZE      " Minimize window "
  187. #define STATUSMAXIMIZE      " Maximize window "
  188. #define STATUSCLOSE         " Close window "
  189. #define STATUSNEXTWINDOW    " Switch to next window "
  190. #define STATUSPREVWINDOW    " Switch to previous window "
  191. #define STATUSTASKLIST      " Bring up task list "
  192. #define STATUSPOPUPLOGIN    " Login and logout commands "
  193. #define STATUSCONNECT        " Connect with default parameters... "
  194. #define STATUSDISCONNECT    " Release open sessions... "
  195. #define STATUSEXIT            " Exit application "
  196. #define STATUSPOPUPQUERY    " Commands "
  197. #define STATUSQUERY            " Execute Command text... "
  198. #define STATUSNEW            " New Command on current Session... "
  199. #define STATUSPOPUPSCHEMA    " IDBSchema Commands "
  200.  
  201. #define    STATUSASSERTIONS              " DBSCHEMA_ASSERTIONS Rowset "
  202. #define STATUSCATALOGS                  " DBSCHEMA_CATALOGS Rowset "
  203. #define STATUSCHARACTER_SETS          " DBSCHEMA_CHARACTER_SETS Rowset "
  204. #define STATUSCHECK_CONSTRAINTS          " DBSCHEMA_CHECK_CONSTRAINTS Rowset "
  205. #define STATUSCOLLATIONS              " DBSCHEMA_COLLATIONS Rowset "
  206. #define STATUSCOLUMN_DOMAIN_USAGE      " DBSCHEMA_COLUMN_DOMAIN_USAGE Rowset "
  207. #define STATUSCOLUMN_PRIVILEGES          " DBSCHEMA_COLUMN_PRIVILEGES Rowset "
  208. #define STATUSCOLUMNS                  " DBSCHEMA_COLUMNS Rowset "
  209. #define STATUSCONSTRAINT_COLUMN_USAGE " DBSCHEMA_CONSTRAINT_COLUMN_USAGE Rowset "
  210. #define STATUSCONSTRAINT_TABLE_USAGE  " DBSCHEMA_CONSTRAINT_TABLE_USAGE Rowset "
  211. #define STATUSFOREIGN_KEYS              " DBSCHEMA_FOREIGN_KEYS Rowset "
  212. #define STATUSINDEXES                  " DBSCHEMA_INDEXES Rowset "
  213. #define STATUSKEY_COLUMN_USAGE          " DBSCHEMA_KEY_COLUMN_USAGE Rowset "
  214. #define STATUSPRIMARY_KEYS              " DBSCHEMA_PRIMARY_KEYS Rowset "
  215. #define STATUSPROCEDURE_COLUMNS          " DBSCHEMA_PROCEDURE_COLUMNS Rowset "
  216. #define STATUSPROCEDURE_PARAMETERS      " DBSCHEMA_PROCEDURE_PARAMETERS Rowset "
  217. #define STATUSPROCEDURES              " DBSCHEMA_PROCEDURES Rowset "
  218. #define STATUSPROVIDER_TYPES          " DBSCHEMA_PROVIDER_TYPES Rowset "
  219. #define STATUSREFERENTIAL_CONSTRAINTS " DBSCHEMA_REFERENTIAL_CONSTRAINTS Rowset "    
  220. #define STATUSSCHEMATA                  " DBSCHEMA_SCHEMATA Rowset "
  221. #define STATUSSQL_LANGUAGES              " DBSCHEMA_SQL_LANGUAGES Rowset "
  222. #define STATUSSTATISTICS              " DBSCHEMA_STATISTICS    Rowset "
  223. #define STATUSTABLE_CONSTRAINTS          " DBSCHEMA_TABLE_CONSTRAINTS Rowset "
  224. #define STATUSTABLE_PRIVILEGES          " DBSCHEMA_TABLE_PRIVILEGES Rowset "    
  225. #define STATUSTABLES                  " DBSCHEMA_TABLES Rowset "
  226. #define STATUSTRANSLATIONS              " DBSCHEMA_TRANSLATIONS Rowset "    
  227. #define STATUSUSAGE_PRIVILEGES          " DBSCHEMA_USAGE_PRIVILEGES Rowset "    
  228. #define STATUSVIEW_COLUMN_USAGE          " DBSCHEMA_VIEW_COLUMN_USAGE Rowset "    
  229. #define STATUSVIEW_TABLE_USAGE          " DBSCHEMA_VIEW_TABLE_USAGE Rowset "        
  230. #define STATUSVIEWS                      " DBSCHEMA_VIEWS Rowset "    //ADDED
  231.  
  232. #define STATUSPOPUPWINDOW    " Window management commands "
  233. #define STATUSTILE            " Tile all normal child windows "
  234. #define STATUSCASCADE        " Cascade all normal child windows "
  235. #define STATUSICONS            " Arrange iconic child windows "
  236. #define STATUSCLOSEALL        " Close all child windows "
  237. #define STATUSMDICHILD      " Activate the window marked as %d"
  238. #define STATUSPOPUPHELP        " Help commands "
  239. #define STATUSAPPHELP        " Display help on application "
  240. #define STATUSABOUT            " About application "
  241. #define STATUSDEFAULT        " Ready "
  242.  
  243. #define DEFDBNAME                        "?"
  244. #define PROVIDER_SESSION_FORMAT            "%s!%lX"
  245. #define PROVIDER_SESSION_COMMAND_FORMAT    "Provider:=%s!Session=%lX!Command=%lX"
  246. #define SCANPROVIDERSESSION_FORMAT        "%[^!]!%lX"
  247. #define SCANSESSION_FORMAT                "%*[^!]!%lX"
  248. #define SCANSESSION_TITLEFORMAT            "Provider:=%*[^!]!Session=%lX"
  249. #define SCANSESSIONCOMMAND_FORMAT        "Provider:=%*[^!]!Session=%lX!Command=%lX"
  250. #define SCANCOMMAND_TITLEFORMAT            "Provider:=%*[^!]!Session=%*lX!Command=%lX"
  251. #define CUR_MARK                "<-"
  252. #define CURQUERY_STRING            "Command!%lX<-"
  253. #define QUERY_STRING            "Command!%lX"
  254. #define MAKECONNECT                "Please connect to a data source using Login menu."
  255. #define    OPENWINDOW                "Please open a window from Query menu."
  256. #define NOSESSIONERROR            "No Session Available"
  257. #define NOCOMMANDERROR            "No Command Window Available"
  258. #define MAXCHILDEXCEEDED        "Please close a child window and try again."
  259. #define MAXCHLDERR                "Error - Too many Child Windows"
  260. #define COLTRUNC_WARNG            "Number of columns in display truncated to %u"
  261. #define ROWTRUNC_WARNG            "Number of rows in display truncated to %u"
  262. #define TRUNCERR                "Data Truncation"
  263. #define CLOSEALLSESSION            "All open sessions have been released."
  264. #define LOGOUTINFO                "Log Out Information"
  265. #define SQLERR_FORMAT            "SQL Error State:%s, Native Error Code: %lX, OLEDB Error: %s"
  266. #define SQLERRMSGTITLE            "SQL_ERROR results"
  267. #define SQLERRCNTDTITLE            "SQL_ERROR results continued"
  268. #define SQLWRNMSGTITLE            "SQL_SUCCESS_WITH_INFO results"
  269. #define SQLWRNCNTDTITLE            "SQL_SUCCESS_WITH_INFO results continued"
  270. #define NULLDATASTRING            "SQL_NULL_DATA"
  271.  
  272. /* Globals */
  273. //HWND        hWndFrame;          // Main Frame Window handle
  274. //HWND        hWndCrsrList;       // hdbc(s) combobox on the tool bar
  275. //HWND        hWndStmtList;       // hstmt(s) combobox on the tool bar
  276. //HWND        hWndMDIClient;      // MDI Client window handle
  277. //HWND        hWndActiveChild;    // Current active MDI Child window
  278. //HINSTANCE    hAppInstance;       // Application instance
  279.  
  280.  
  281. /* Macros and Function Prototypes */
  282. #ifdef WIN32
  283. #define        ACTIVATEWINDOW(h)    SetForegroundWindow(h)
  284. #else
  285. #define        ACTIVATEWINDOW(h)    SetFocus(h)
  286. #endif
  287.  
  288. #define DRAWBTTNRECT(h,x,y,cx,cy)    MoveToEx(h,x+1,y,NULL);\
  289.                     LineTo(h,x+cx,y);\
  290.                     MoveToEx(h,x+cx,y+1,NULL);\
  291.                     LineTo(h,x+cx,y+cy);\
  292.                     MoveToEx(h,x+cx-1,y+cy,NULL);\
  293.                     LineTo(h,x,y+cy);\
  294.                     MoveToEx(h,x,y+cy-1,NULL);\
  295.                     LineTo(h,x,y);
  296.  
  297. #define DRAWBTTNLIFT1(h,x,y,cx,cy)    MoveToEx(h,x+1,y+cy-1,NULL);\
  298.                     LineTo(h,x+1,y+1);\
  299.                     LineTo(h,x+cx-1,y+1);
  300.  
  301. #define    DRAWBTTNLIFT2(h,x,y,cx,cy)    MoveToEx(h,x+1,y+cy-1,NULL);\
  302.                     LineTo(h,x+cx-1,y+cy-1);\
  303.                     LineTo(h,x+cx-1,y);\
  304.                     MoveToEx(h,x+2,y+cy-2,NULL);\
  305.                     LineTo(h,x+cx-2,y+cy-2);\
  306.                     LineTo(h,x+cx-2,y+1);
  307. // MAIN.CPP
  308. int        PASCAL        WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow);
  309. long    CALLBACK    MainWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
  310. long    CALLBACK    ToolbarProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
  311. long    CALLBACK    StatusbarProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
  312. long    CALLBACK    MDIChildProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
  313. BOOL    CALLBACK    ConnectDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
  314. BOOL    CALLBACK    DisconnectDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
  315. BOOL    CALLBACK    AboutDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
  316. BOOL    CALLBACK    MDIChildDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
  317. VOID    FAR PASCAL    DrawBitmap(HDC hDC, int iLeft, int iTop, HBITMAP hBitmap);
  318.  
  319. // QURYDEMO.CPP
  320. BOOL    FAR PASCAL    InitEnvironment();
  321. void    FAR PASCAL    DisplayProviders(HWND hWnd);
  322. BOOL    FAR PASCAL  ConnectDatabase(HWND hWnd);
  323. void    FAR PASCAL    DisplayConnections(HWND hWndhdbc);
  324. void    FAR PASCAL    DisplayICommands(HWND hWndhstmt, HWND hWndhdbc, int nCrsrIndex);
  325. void    FAR PASCAL    NewICommandWindow();
  326. void    FAR PASCAL    NewIOpenRowsetWindow();
  327. void    FAR PASCAL    ChangeCurrentICommand(HWND hWndStmtList);
  328. void    FAR PASCAL    ChangeCurrentCursor(HWND hWndCrsrList);
  329. void    FAR PASCAL    DisplayNewCrsrAndICommand();
  330. void    FAR PASCAL    FreeConnect(HWND hWndhdbc);
  331. void    FAR PASCAL    FreeICommand(HWND hWndhstmt, HWND hWndhdbc, int nIndex);
  332. void    FAR PASCAL    CloseICommandWindow(HWND hWnd);
  333. void    FAR PASCAL    ExecuteQuery();
  334. BOOL    FAR PASCAL    CloseIDBCreateCommand();
  335. HRESULT DisplayDataSource(HWND hWnd);
  336. HRESULT    FreeEnvironment();
  337. void    FAR PASCAL    GetSchemaRowset(GUID rguidSchema);
  338.  
  339. HRESULT EnumerateProviders ();
  340.  
  341. HRESULT ExecuteCommand
  342.     (
  343.     IUnknown*    pIUnknown,
  344.     ICommand*    pICommand,
  345.     LPWSTR        wszBuffer,
  346.     IRowset**    ppIRowset_out 
  347.     );
  348.  
  349. HRESULT GetDataFromRowset
  350.     (
  351.     IRowset*    pIRowset
  352.     );
  353.  
  354. HRESULT GetColumnsInfo
  355.     (
  356.     IRowset*        pIRowset,
  357.     ULONG*             pcCol,
  358.     DBCOLUMNINFO**    ppColumnInfo,
  359.     WCHAR**            ppStringsBuffer
  360.     );
  361.  
  362. HRESULT SetupBindings
  363.     (
  364.     ULONG             cCol,
  365.     DBCOLUMNINFO*    pColumnInfo,
  366.     DBBINDING*        rgBind_out,
  367.     ULONG*            cBind_out,
  368.     ULONG*          pcMaxRowSize_out
  369.     );
  370.     
  371. HRESULT CreateAccessor
  372.     (
  373.     IRowset*    pIRowset,
  374.     DBBINDING*    rgBind,
  375.     ULONG        cBind,
  376.     HACCESSOR*    phAccessor_out
  377.     );
  378.  
  379. HRESULT GetData
  380.     (
  381.     IRowset*        pIRowset,
  382.     ULONG           cMaxRowSize,
  383.     HACCESSOR        hAccessor,
  384.     DBBINDING*        rgBind,            // needed for pretty printing
  385.     ULONG            cBind,            // for pretty printing
  386.     DBCOLUMNINFO*    pColumnInfo,     // for pretty printing
  387.     ULONG            cCol,            // for pretty printing        
  388.     HWND            hList,
  389.     DWORD            dwText,
  390.     DWORD            addString
  391.     );
  392.  
  393. HRESULT CleanupRowset
  394.     (
  395.     IRowset*    pIRowset,
  396.     HACCESSOR     hAccessor
  397.     );
  398.  
  399. void DumpRow
  400.     (
  401.     DBBINDING*     rgBind,
  402.     ULONG        cBind,
  403.     ULONG        cMaxColWidth,
  404.     BYTE*         pData,
  405.     HWND        hList,
  406.     DWORD        dwText,
  407.     DWORD        addString
  408.     );
  409.  
  410. HRESULT GetDetailedErrorInfo 
  411.       (
  412.        HRESULT    hr,
  413.        IUnknown * pBadObject,                  
  414.        GUID IID_BadIntereface,        
  415.        LPSTR    lpStrBuffer
  416. //       char * szErrorDescription_out,
  417. //       char * szErrorSource_out
  418.       );
  419.  
  420. /*
  421. void DumpError
  422.      ( HRESULT hr, 
  423.        LPSTR lpStrBuffer, 
  424.        LPSTR lpSource, 
  425.        LPSTR lpDescription
  426.       );
  427. */
  428.  
  429. void DumpErrorHResult
  430.     ( 
  431.     HRESULT hr,
  432.     LPSTR lpStrBuffer
  433.     );
  434.  
  435. // How to lay out each column in memory.
  436. // Note that bData should be DWORD aligned, since it may contain a DWORD.
  437. struct COLUMNDATA 
  438.     {
  439.     DBSTATUS    wStatus;    // status of column
  440.     DWORD        dwLength;    // length of data (not space allocated)
  441.     BYTE        bData[1];    // data here and beyond
  442.     };
  443.  
  444.  
  445. /******************************* End of File ********************************/
  446.