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

  1. // collect.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 "collect.h"
  15.  
  16. #include "mainfrm.h"
  17. #include "colledoc.h"
  18. #include "strlstvw.h"
  19.  
  20. #ifdef _DEBUG
  21. #undef THIS_FILE
  22. static char BASED_CODE THIS_FILE[] = __FILE__;
  23. #endif
  24.  
  25. /////////////////////////////////////////////////////////////////////////////
  26. // CCollectApp
  27.  
  28. BEGIN_MESSAGE_MAP(CCollectApp, CWinApp)
  29.     //{{AFX_MSG_MAP(CCollectApp)
  30.     ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
  31.     //}}AFX_MSG_MAP
  32.     // Standard file based document commands
  33.     ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
  34.     ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
  35.     // Standard print setup command
  36.     ON_COMMAND(ID_FILE_PRINT_SETUP, CWinApp::OnFilePrintSetup)
  37. END_MESSAGE_MAP()
  38.  
  39. /////////////////////////////////////////////////////////////////////////////
  40. // CCollectApp construction
  41.  
  42. CCollectApp::CCollectApp()
  43. {
  44. }
  45.  
  46. /////////////////////////////////////////////////////////////////////////////
  47. // The one and only CCollectApp object
  48.  
  49. CCollectApp theApp;
  50.  
  51. /////////////////////////////////////////////////////////////////////////////
  52. // CCollectApp initialization
  53.  
  54. BOOL CCollectApp::InitInstance()
  55. {
  56.     // Standard initialization
  57.  
  58.     Enable3dControls();
  59.  
  60.     LoadStdProfileSettings();  // 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(CCollectDoc),
  68.         RUNTIME_CLASS(CMainFrame),       // main SDI frame window
  69.         RUNTIME_CLASS(CStringListView));
  70.     AddDocTemplate(pDocTemplate);
  71.  
  72.     // create a new (empty) document
  73.     OnFileNew();
  74.  
  75.     if (m_lpCmdLine[0] != '\0')
  76.     {
  77.     }
  78.  
  79.     return TRUE;
  80. }
  81.  
  82. /////////////////////////////////////////////////////////////////////////////
  83. // CAboutDlg dialog used for App About
  84.  
  85. class CAboutDlg : public CDialog
  86. {
  87. public:
  88.     CAboutDlg();
  89.  
  90. // Dialog Data
  91.     //{{AFX_DATA(CAboutDlg)
  92.     enum { IDD = IDD_ABOUTBOX };
  93.     //}}AFX_DATA
  94.  
  95. // Implementation
  96. protected:
  97.     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
  98.     //{{AFX_MSG(CAboutDlg)
  99.         // No message handlers
  100.     //}}AFX_MSG
  101.     DECLARE_MESSAGE_MAP()
  102. };
  103.  
  104. CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
  105. {
  106.     //{{AFX_DATA_INIT(CAboutDlg)
  107.     //}}AFX_DATA_INIT
  108. }
  109.  
  110. void CAboutDlg::DoDataExchange(CDataExchange* pDX)
  111. {
  112.     CDialog::DoDataExchange(pDX);
  113.     //{{AFX_DATA_MAP(CAboutDlg)
  114.     //}}AFX_DATA_MAP
  115. }
  116.  
  117. BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
  118.     //{{AFX_MSG_MAP(CAboutDlg)
  119.         // No message handlers
  120.     //}}AFX_MSG_MAP
  121. END_MESSAGE_MAP()
  122.  
  123. // App command to run the dialog
  124. void CCollectApp::OnAppAbout()
  125. {
  126.     CAboutDlg aboutDlg;
  127.     aboutDlg.DoModal();
  128. }
  129.  
  130. /////////////////////////////////////////////////////////////////////////////
  131. // CCollectApp commands
  132.