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

  1. // catalog.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.  
  14. #include "stdafx.h"
  15. #include "catalog.h"
  16.  
  17. #include "mainfrm.h"
  18. #include "tableset.h"
  19. #include "columnst.h"
  20. #include "cataldoc.h"
  21. #include "catalvw.h"
  22.  
  23. #ifdef _DEBUG
  24. #undef THIS_FILE
  25. static char BASED_CODE THIS_FILE[] = __FILE__;
  26. #endif
  27.  
  28. /////////////////////////////////////////////////////////////////////////////
  29. // CCatalogApp
  30.  
  31. BEGIN_MESSAGE_MAP(CCatalogApp, CWinApp)
  32.     //{{AFX_MSG_MAP(CCatalogApp)
  33.     ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
  34.         // NOTE - the ClassWizard will add and remove mapping macros here.
  35.         //    DO NOT EDIT what you see in these blocks of generated code!
  36.     //}}AFX_MSG_MAP
  37. END_MESSAGE_MAP()
  38.  
  39. /////////////////////////////////////////////////////////////////////////////
  40. // CCatalogApp construction
  41.  
  42. CCatalogApp::CCatalogApp()
  43. {
  44.     // TODO: add construction code here,
  45.     // Place all significant initialization in InitInstance
  46. }
  47.  
  48. /////////////////////////////////////////////////////////////////////////////
  49. // The one and only CCatalogApp object
  50.  
  51. CCatalogApp NEAR theApp;
  52.  
  53. /////////////////////////////////////////////////////////////////////////////
  54. // CCatalogApp initialization
  55.  
  56. BOOL CCatalogApp::InitInstance()
  57. {
  58.     // Standard initialization
  59.     // If you are not using these features and wish to reduce the size
  60.     //  of your final executable, you should remove from the following
  61.     //  the specific initialization routines you do not need.
  62.  
  63.     Enable3dControls();    // Use 3d controls in dialogs
  64.     LoadStdProfileSettings();  // Load standard INI file options (including MRU)
  65.  
  66.     // Register the application's document templates.  Document templates
  67.     //  serve as the connection between documents, frame windows and views.
  68.  
  69.     CSingleDocTemplate* pDocTemplate;
  70.     pDocTemplate = new CSingleDocTemplate(
  71.         IDR_MAINFRAME,
  72.         RUNTIME_CLASS(CCatalogDoc),
  73.         RUNTIME_CLASS(CMainFrame),     // main SDI frame window
  74.         RUNTIME_CLASS(CCatalogView));
  75.     AddDocTemplate(pDocTemplate);
  76.  
  77.     // create a new (empty) document
  78.     OnFileNew();
  79.  
  80.     if (m_lpCmdLine[0] != '\0')
  81.     {
  82.         // TODO: add command line processing here
  83.     }
  84.  
  85.  
  86.     return TRUE;
  87. }
  88.  
  89. /////////////////////////////////////////////////////////////////////////////
  90. // CAboutDlg dialog used for App About
  91.  
  92. class CAboutDlg : public CDialog
  93. {
  94. public:
  95.     CAboutDlg();
  96.  
  97. // Dialog Data
  98.     //{{AFX_DATA(CAboutDlg)
  99.     enum { IDD = IDD_ABOUTBOX };
  100.     //}}AFX_DATA
  101.  
  102. // Implementation
  103. protected:
  104.     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
  105.     //{{AFX_MSG(CAboutDlg)
  106.         // No message handlers
  107.     //}}AFX_MSG
  108.     DECLARE_MESSAGE_MAP()
  109. };
  110.  
  111. CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
  112. {
  113.     //{{AFX_DATA_INIT(CAboutDlg)
  114.     //}}AFX_DATA_INIT
  115. }
  116.  
  117. void CAboutDlg::DoDataExchange(CDataExchange* pDX)
  118. {
  119.     CDialog::DoDataExchange(pDX);
  120.     //{{AFX_DATA_MAP(CAboutDlg)
  121.     //}}AFX_DATA_MAP
  122. }
  123.  
  124. BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
  125.     //{{AFX_MSG_MAP(CAboutDlg)
  126.         // No message handlers
  127.     //}}AFX_MSG_MAP
  128. END_MESSAGE_MAP()
  129.  
  130. // App command to run the dialog
  131. void CCatalogApp::OnAppAbout()
  132. {
  133.     CAboutDlg aboutDlg;
  134.     aboutDlg.DoModal();
  135. }
  136.  
  137. /////////////////////////////////////////////////////////////////////////////
  138. // CCatalogApp commands
  139.