home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / sdk / dbmsg / odbc / admndemo / child.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-10-06  |  3.5 KB  |  72 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:   CHILD.H
  8. //|      This files sole purpose in life is to define the CHILDINFO type
  9. //|         which is the main data structure for a connection window.
  10. //*---------------------------------------------------------------------------------
  11. #ifndef child_DEFS
  12. #define child_DEFS
  13.  
  14. #include <Windows.h>
  15. #include <stdlib.h>
  16. #include "commdlg.h"
  17. #include "standard.h"
  18. #include "menu.h"
  19. #include "results.h"
  20. #include "sql.h"
  21. #include "sqlext.h"
  22.  
  23. #define MAXCONNECTS        15
  24.  
  25.  
  26. //*------------------------------------------------------------------------
  27. //|  The following structure is used to keep track of the vital pieces of
  28. //|      information for each child MDI window.  The actual structure is
  29. //|      stored with the window and can be extracted with only the window
  30. //|      handle.
  31. //*------------------------------------------------------------------------
  32. typedef struct tagCHILDINFO {
  33.    HINSTANCE      hInst;                        // Handle to our data segment
  34.    HWND           hwndClient;                   // Handle to client window
  35.    HWND           hwnd;                         // Handle to the child window
  36.    HWND           hwndIn;                       // Input window
  37.    HWND           hwndOut;                      // Output window
  38.    HENV           henv;                         // Environment handle for application
  39.    HDBC           hdbc;                         // Connection handle of this window
  40.    HSTMT          hstmt;                        // Statement handle for this window
  41.  
  42.    // Display information
  43.    int            dx;                           // Width of client area
  44.    int            dy;                           // Height of client area
  45.  
  46.    char           szConnStrOut[DFTBUFFSIZE];    // Save returned connect string
  47.    char           CurrentUser[DFTBUFFSIZE];     // Name of user logged on this window
  48.    char           CurrentServer[DFTBUFFSIZE];   // Server connected to in this window
  49.    int            listtype;                     // What are we listing
  50.    char           szClientTitle[MAXBUFF];       // Title for the window
  51.    UDWORD         fFunctions[MINREQUIREDINTS(NUM_MENU_FLAGS)];
  52.                                                 // bitmask to track supported functions
  53.    HFILE          hFile;                        // Pointer to file
  54.    char           szFile[_MAX_PATH];            // Name of the file
  55.    int            cbFileSize;                   // How big is the file
  56.    LPSTR          szFileBuff;                   // Memory for the file
  57.    int            cbResultCount;                // Incremental counter of results windows
  58.    int            cbMaxRS;                      // Maximum results windows
  59.    int            cbResults;                    // Current count of results sets
  60.    LPVOID         lprihead;                     // Head node
  61.    LPVOID         lpritail;                     // Tail node
  62.    } CHILDINFO, FAR * lpCHILDINFO;
  63.  
  64.  
  65. // Since this is an MDI app, we will store the connection window information with
  66. // the window handle and must then get this value for each message processed.
  67. // This little macro simply sets the value of ci based on the window
  68. #define GETCIPOINTER(hwnd) (lpCHILDINFO)(GetWindowLong(hwnd, 0))
  69. #define SETCIPOINTER(hwnd, x) SetWindowLong(hwnd, 0, (LONG)(x))
  70.  
  71. #endif
  72.