home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / mfc / general / dbvlist / dbvlist.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1998-03-27  |  3.4 KB  |  140 lines

  1. // DBVList.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 "DBVList.h"
  15.  
  16. #include "MainFrm.h"
  17. #include "DBVListSet.h"
  18. #include "DBVListDoc.h"
  19. #include "DBVListView.h"
  20.  
  21. #ifdef _DEBUG
  22. #define new DEBUG_NEW
  23. #undef THIS_FILE
  24. static char THIS_FILE[] = __FILE__;
  25. #endif
  26.  
  27. /////////////////////////////////////////////////////////////////////////////
  28. // CDBVListApp
  29.  
  30. BEGIN_MESSAGE_MAP(CDBVListApp, CWinApp)
  31.     //{{AFX_MSG_MAP(CDBVListApp)
  32.     ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
  33.     //}}AFX_MSG_MAP
  34. END_MESSAGE_MAP()
  35.  
  36. /////////////////////////////////////////////////////////////////////////////
  37. // CDBVListApp construction
  38.  
  39. CDBVListApp::CDBVListApp()
  40. {
  41. }
  42.  
  43. /////////////////////////////////////////////////////////////////////////////
  44. // The one and only CDBVListApp object
  45.  
  46. CDBVListApp theApp;
  47.  
  48. /////////////////////////////////////////////////////////////////////////////
  49. // CDBVListApp initialization
  50.  
  51. BOOL CDBVListApp::InitInstance()
  52. {
  53.     AfxEnableControlContainer();
  54.  
  55.     // Standard initialization
  56.  
  57.     // Change the registry key under which our settings are stored.
  58.     SetRegistryKey(_T("Local AppWizard-Generated Applications"));
  59.  
  60.     LoadStdProfileSettings(0);  // Load standard INI file options (including MRU)
  61.  
  62.     // Register document templates
  63.  
  64.     CSingleDocTemplate* pDocTemplate;
  65.     pDocTemplate = new CSingleDocTemplate(
  66.         IDR_MAINFRAME,
  67.         RUNTIME_CLASS(CDBVListDoc),
  68.         RUNTIME_CLASS(CMainFrame),       // main SDI frame window
  69.         RUNTIME_CLASS(CDBVListView));
  70.     AddDocTemplate(pDocTemplate);
  71.  
  72.     // Parse command line for standard shell commands, DDE, file open
  73.     CCommandLineInfo cmdInfo;
  74.     ParseCommandLine(cmdInfo);
  75.  
  76.     // Dispatch commands specified on the command line
  77.     if (!ProcessShellCommand(cmdInfo))
  78.         return FALSE;
  79.     m_pMainWnd->ShowWindow(SW_SHOW);
  80.     m_pMainWnd->UpdateWindow();
  81.  
  82.     return TRUE;
  83. }
  84.  
  85. /////////////////////////////////////////////////////////////////////////////
  86. // CAboutDlg dialog used for App About
  87.  
  88. class CAboutDlg : public CDialog
  89. {
  90. public:
  91.     CAboutDlg();
  92.  
  93. // Dialog Data
  94.     //{{AFX_DATA(CAboutDlg)
  95.     enum { IDD = IDD_ABOUTBOX };
  96.     //}}AFX_DATA
  97.  
  98.     // ClassWizard generated virtual function overrides
  99.     //{{AFX_VIRTUAL(CAboutDlg)
  100.     protected:
  101.     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
  102.     //}}AFX_VIRTUAL
  103.  
  104. // Implementation
  105. protected:
  106.     //{{AFX_MSG(CAboutDlg)
  107.         // No message handlers
  108.     //}}AFX_MSG
  109.     DECLARE_MESSAGE_MAP()
  110. };
  111.  
  112. CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
  113. {
  114.     //{{AFX_DATA_INIT(CAboutDlg)
  115.     //}}AFX_DATA_INIT
  116. }
  117.  
  118. void CAboutDlg::DoDataExchange(CDataExchange* pDX)
  119. {
  120.     CDialog::DoDataExchange(pDX);
  121.     //{{AFX_DATA_MAP(CAboutDlg)
  122.     //}}AFX_DATA_MAP
  123. }
  124.  
  125. BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
  126.     //{{AFX_MSG_MAP(CAboutDlg)
  127.         // No message handlers
  128.     //}}AFX_MSG_MAP
  129. END_MESSAGE_MAP()
  130.  
  131. // App command to run the dialog
  132. void CDBVListApp::OnAppAbout()
  133. {
  134.     CAboutDlg aboutDlg;
  135.     aboutDlg.DoModal();
  136. }
  137.  
  138. /////////////////////////////////////////////////////////////////////////////
  139. // CDBVListApp commands
  140.