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

  1. // MFCRow.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 "MFCRow.h"
  15.  
  16. #include "MainFrm.h"
  17. #include "MFCRowSet.h"
  18. #include "MFCRowDoc.h"
  19. #include "MFCRowView.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. // CMFCRowApp
  29.  
  30. BEGIN_MESSAGE_MAP(CMFCRowApp, CWinApp)
  31.     //{{AFX_MSG_MAP(CMFCRowApp)
  32.     ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
  33.         // NOTE - the ClassWizard will add and remove mapping macros here.
  34.         //    DO NOT EDIT what you see in these blocks of generated code!
  35.     //}}AFX_MSG_MAP
  36.     // Standard print setup command
  37.     ON_COMMAND(ID_FILE_PRINT_SETUP, CWinApp::OnFilePrintSetup)
  38. END_MESSAGE_MAP()
  39.  
  40. /////////////////////////////////////////////////////////////////////////////
  41. // CMFCRowApp construction
  42.  
  43. CMFCRowApp::CMFCRowApp()
  44. {
  45.     // TODO: add construction code here,
  46.     // Place all significant initialization in InitInstance
  47. }
  48.  
  49. /////////////////////////////////////////////////////////////////////////////
  50. // The one and only CMFCRowApp object
  51.  
  52. CMFCRowApp theApp;
  53.  
  54. // CComModule object for ATL
  55.  
  56. CComModule _Module;
  57.  
  58. /////////////////////////////////////////////////////////////////////////////
  59. // CMFCRowApp initialization
  60.  
  61. BOOL CMFCRowApp::InitInstance()
  62. {
  63.     CoInitialize(NULL);
  64.     AfxEnableControlContainer();
  65.  
  66.     // Standard initialization
  67.     // If you are not using these features and wish to reduce the size
  68.     //  of your final executable, you should remove from the following
  69.     //  the specific initialization routines you do not need.
  70.  
  71. #ifdef _AFXDLL
  72.     Enable3dControls();         // Call this when using MFC in a shared DLL
  73. #else
  74.     Enable3dControlsStatic();   // Call this when linking to MFC statically
  75. #endif
  76.  
  77.     // Change the registry key under which our settings are stored.
  78.     // You should modify this string to be something appropriate
  79.     // such as the name of your company or organization.
  80.     SetRegistryKey(_T("Local AppWizard-Generated Applications"));
  81.  
  82.     LoadStdProfileSettings();  // Load standard INI file options (including MRU)
  83.  
  84.     // Register the application's document templates.  Document templates
  85.     //  serve as the connection between documents, frame windows and views.
  86.  
  87.     CSingleDocTemplate* pDocTemplate;
  88.     pDocTemplate = new CSingleDocTemplate(
  89.         IDR_MAINFRAME,
  90.         RUNTIME_CLASS(CMFCRowDoc),
  91.         RUNTIME_CLASS(CMainFrame),       // main SDI frame window
  92.         RUNTIME_CLASS(CMFCRowView));
  93.     AddDocTemplate(pDocTemplate);
  94.  
  95.     // Parse command line for standard shell commands, DDE, file open
  96.     CCommandLineInfo cmdInfo;
  97.     ParseCommandLine(cmdInfo);
  98.  
  99.     // Dispatch commands specified on the command line
  100.     if (!ProcessShellCommand(cmdInfo))
  101.         return FALSE;
  102.  
  103.     // The one and only window has been initialized, so show and update it.
  104.     m_pMainWnd->ShowWindow(SW_SHOW);
  105.     m_pMainWnd->UpdateWindow();
  106.  
  107.     return TRUE;
  108. }
  109.  
  110. /////////////////////////////////////////////////////////////////////////////
  111. // CAboutDlg dialog used for App About
  112.  
  113. class CAboutDlg : public CDialog
  114. {
  115. public:
  116.     CAboutDlg();
  117.  
  118. // Dialog Data
  119.     //{{AFX_DATA(CAboutDlg)
  120.     enum { IDD = IDD_ABOUTBOX };
  121.     //}}AFX_DATA
  122.  
  123.     // ClassWizard generated virtual function overrides
  124.     //{{AFX_VIRTUAL(CAboutDlg)
  125.     protected:
  126.     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
  127.     //}}AFX_VIRTUAL
  128.  
  129. // Implementation
  130. protected:
  131.     //{{AFX_MSG(CAboutDlg)
  132.         // No message handlers
  133.     //}}AFX_MSG
  134.     DECLARE_MESSAGE_MAP()
  135. };
  136.  
  137. CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
  138. {
  139.     //{{AFX_DATA_INIT(CAboutDlg)
  140.     //}}AFX_DATA_INIT
  141. }
  142.  
  143. void CAboutDlg::DoDataExchange(CDataExchange* pDX)
  144. {
  145.     CDialog::DoDataExchange(pDX);
  146.     //{{AFX_DATA_MAP(CAboutDlg)
  147.     //}}AFX_DATA_MAP
  148. }
  149.  
  150. BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
  151.     //{{AFX_MSG_MAP(CAboutDlg)
  152.         // No message handlers
  153.     //}}AFX_MSG_MAP
  154. END_MESSAGE_MAP()
  155.  
  156. // App command to run the dialog
  157. void CMFCRowApp::OnAppAbout()
  158. {
  159.     CAboutDlg aboutDlg;
  160.     aboutDlg.DoModal();
  161. }
  162.  
  163. /////////////////////////////////////////////////////////////////////////////
  164. // CMFCRowApp commands
  165.