home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / mfc / database / odbcinfo / odbcinfo.cpp < prev    next >
C/C++ Source or Header  |  1998-03-26  |  3KB  |  111 lines

  1. // OdbcInfo.cpp : Defines the class behaviors for the application.
  2. //
  3. // This is a part of the Microsoft Foundation Classes C++ library.
  4. // Copyright (C) 1992-1998 Microsoft Corporation
  5. // All rights reserved.
  6. //
  7. // This source code is only intended as a supplement to the
  8. // Microsoft Foundation Classes Reference and related
  9. // electronic documentation provided with the library.
  10. // See these sources for detailed information regarding the
  11. // Microsoft Foundation Classes product.
  12.  
  13. #include "stdafx.h"
  14. #include "OdbcInfo.h"
  15. #include "MySheet.h"
  16. #include "catsets.h"
  17. #include "DrvInfo.h"
  18.  
  19. #ifdef _DEBUG
  20. #define new DEBUG_NEW
  21. #undef THIS_FILE
  22. static char THIS_FILE[] = __FILE__;
  23. #endif
  24.  
  25. /////////////////////////////////////////////////////////////////////////////
  26. // COdbcInfoApp
  27.  
  28. BEGIN_MESSAGE_MAP(COdbcInfoApp, CWinApp)
  29.     //{{AFX_MSG_MAP(COdbcInfoApp)
  30.         // NOTE - the ClassWizard will add and remove mapping macros here.
  31.         //    DO NOT EDIT what you see in these blocks of generated code!
  32.     //}}AFX_MSG
  33.     ON_COMMAND(ID_HELP, CWinApp::OnHelp)
  34. END_MESSAGE_MAP()
  35.  
  36. /////////////////////////////////////////////////////////////////////////////
  37. // COdbcInfoApp construction
  38.  
  39. COdbcInfoApp::COdbcInfoApp()
  40. {
  41.     // TODO: add construction code here,
  42.     // Place all significant initialization in InitInstance
  43. }
  44.  
  45. /////////////////////////////////////////////////////////////////////////////
  46. // The one and only COdbcInfoApp object
  47.  
  48. COdbcInfoApp theApp;
  49.  
  50. /////////////////////////////////////////////////////////////////////////////
  51. // COdbcInfoApp initialization
  52.  
  53. BOOL COdbcInfoApp::InitInstance()
  54. {
  55.     // Standard initialization
  56.     // If you are not using these features and wish to reduce the size
  57.     //  of your final executable, you should remove from the following
  58.     //  the specific initialization routines you do not need.
  59.  
  60. #ifdef _AFXDLL
  61.     Enable3dControls();         // Call this when using MFC in a shared DLL
  62. #else
  63.     Enable3dControlsStatic();   // Call this when linking to MFC statically
  64. #endif
  65.  
  66.     // create our property sheet
  67.     CMyPropertySheet    sheet(_T("ODBC Info"));
  68.  
  69.     // create all our property pages
  70.     CDriverInfo         DriverInfoPage(&m_Database);
  71.     CFunctions          FunctionsPage(&m_Database);
  72.     CSupportedSQL       SupportedSQLPage(&m_Database);
  73.     CDataTypes          DataTypesPage(&m_Database);
  74.     CIdentifiers        IdentifiersPage(&m_Database);
  75.     CLimits             LimitsPage(&m_Database);
  76.     CMisc1              Misc1Page(&m_Database);
  77.     CMisc2              Misc2Page(&m_Database);
  78.  
  79.     // add the pages to our sheet
  80.     sheet.AddPage(&DriverInfoPage);
  81.     sheet.AddPage(&FunctionsPage);
  82.     sheet.AddPage(&SupportedSQLPage);
  83.     sheet.AddPage(&DataTypesPage);
  84.     sheet.AddPage(&IdentifiersPage);
  85.     sheet.AddPage(&LimitsPage);
  86.     sheet.AddPage(&Misc1Page);
  87.     sheet.AddPage(&Misc2Page);
  88.  
  89.     // the property sheet is our main window
  90.     m_pMainWnd = &sheet;
  91.  
  92.     // For Win95: display icon in the caption bar
  93.     // and in the taskbar button
  94.     sheet.m_psh.dwFlags |= PSH_USEHICON;
  95.     sheet.m_psh.hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
  96.  
  97.     // run the app
  98.     sheet.DoModal();
  99.  
  100.     return FALSE;
  101. }
  102.  
  103. int COdbcInfoApp::ExitInstance()
  104. {
  105.     // if a database is open, close it
  106.     if (m_Database.IsOpen())
  107.         m_Database.Close();
  108.  
  109.     return CWinApp::ExitInstance();
  110. }
  111.