DAODepartment.cpp
上传用户:benben_wyd
上传日期:2010-02-26
资源大小:1229k
文件大小:4k
源码类别:

书籍源码

开发平台:

Visual C++

  1. // DAODepartment.cpp : Defines the class behaviors for the application.
  2. //
  3. #include "stdafx.h"
  4. #include "DAODepartment.h"
  5. #include "MainFrm.h"
  6. #include "DAODepartmentSet.h"
  7. #include "DAODepartmentDoc.h"
  8. #include "DAODepartmentView.h"
  9. #ifdef _DEBUG
  10. #define new DEBUG_NEW
  11. #undef THIS_FILE
  12. static char THIS_FILE[] = __FILE__;
  13. #endif
  14. /////////////////////////////////////////////////////////////////////////////
  15. // CDAODepartmentApp
  16. BEGIN_MESSAGE_MAP(CDAODepartmentApp, CWinApp)
  17. //{{AFX_MSG_MAP(CDAODepartmentApp)
  18. ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
  19. //}}AFX_MSG_MAP
  20. // Standard file based document commands
  21. ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
  22. ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
  23. // Standard print setup command
  24. ON_COMMAND(ID_FILE_PRINT_SETUP, CWinApp::OnFilePrintSetup)
  25. END_MESSAGE_MAP()
  26. /////////////////////////////////////////////////////////////////////////////
  27. // CDAODepartmentApp construction
  28. CDAODepartmentApp::CDAODepartmentApp()
  29. {
  30. }
  31. /////////////////////////////////////////////////////////////////////////////
  32. // The one and only CDAODepartmentApp object
  33. CDAODepartmentApp theApp;
  34. /////////////////////////////////////////////////////////////////////////////
  35. // CDAODepartmentApp initialization
  36. BOOL CDAODepartmentApp::InitInstance()
  37. {
  38. AfxEnableControlContainer();
  39. // Standard initialization
  40. #ifdef _AFXDLL
  41. Enable3dControls(); // Call this when using MFC in a shared DLL
  42. #else
  43. Enable3dControlsStatic(); // Call this when linking to MFC statically
  44. #endif
  45. // Change the registry key under which our settings are stored.
  46. SetRegistryKey(_T("Local AppWizard-Generated Applications"));
  47. LoadStdProfileSettings();  // Load standard INI file options (including MRU)
  48. // Register document templates
  49. CSingleDocTemplate* pDocTemplate;
  50. pDocTemplate = new CSingleDocTemplate(
  51. IDR_MAINFRAME,
  52. RUNTIME_CLASS(CDAODepartmentDoc),
  53. RUNTIME_CLASS(CMainFrame),       // main SDI frame window
  54. RUNTIME_CLASS(CDAODepartmentView));
  55. AddDocTemplate(pDocTemplate);
  56. // Parse command line for standard shell commands, DDE, file open
  57. CCommandLineInfo cmdInfo;
  58. ParseCommandLine(cmdInfo);
  59. // Dispatch commands specified on the command line
  60. if (!ProcessShellCommand(cmdInfo))
  61. return FALSE;
  62. m_pMainWnd->ShowWindow(SW_SHOW);
  63. m_pMainWnd->UpdateWindow();
  64. return TRUE;
  65. }
  66. /////////////////////////////////////////////////////////////////////////////
  67. // CAboutDlg dialog used for App About
  68. class CAboutDlg : public CDialog
  69. {
  70. public:
  71. CAboutDlg();
  72. // Dialog Data
  73. //{{AFX_DATA(CAboutDlg)
  74. enum { IDD = IDD_ABOUTBOX };
  75. //}}AFX_DATA
  76. // ClassWizard generated virtual function overrides
  77. //{{AFX_VIRTUAL(CAboutDlg)
  78. protected:
  79. virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
  80. //}}AFX_VIRTUAL
  81. // Implementation
  82. protected:
  83. //{{AFX_MSG(CAboutDlg)
  84. // No message handlers
  85. //}}AFX_MSG
  86. DECLARE_MESSAGE_MAP()
  87. };
  88. CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
  89. {
  90. //{{AFX_DATA_INIT(CAboutDlg)
  91. //}}AFX_DATA_INIT
  92. }
  93. void CAboutDlg::DoDataExchange(CDataExchange* pDX)
  94. {
  95. CDialog::DoDataExchange(pDX);
  96. //{{AFX_DATA_MAP(CAboutDlg)
  97. //}}AFX_DATA_MAP
  98. }
  99. BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
  100. //{{AFX_MSG_MAP(CAboutDlg)
  101. // No message handlers
  102. //}}AFX_MSG_MAP
  103. END_MESSAGE_MAP()
  104. // App command to run the dialog
  105. void CDAODepartmentApp::OnAppAbout()
  106. {
  107. CAboutDlg aboutDlg;
  108. aboutDlg.DoModal();
  109. }
  110. /////////////////////////////////////////////////////////////////////////////
  111. // CDAODepartmentApp message handlers