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

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