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

书籍源码

开发平台:

Visual C++

  1. // OLEDBDepartmentMFC.cpp : Defines the class behaviors for the application.
  2. //
  3. #include "stdafx.h"
  4. #include "OLEDBDepartmentMFC.h"
  5. #include "MainFrm.h"
  6. #include "OLEDBDepartmentMFCSet.h"
  7. #include "OLEDBDepartmentMFCDoc.h"
  8. #include "OLEDBDepartmentMFCView.h"
  9. #ifdef _DEBUG
  10. #define new DEBUG_NEW
  11. #undef THIS_FILE
  12. static char THIS_FILE[] = __FILE__;
  13. #endif
  14. /////////////////////////////////////////////////////////////////////////////
  15. // COLEDBDepartmentMFCApp
  16. BEGIN_MESSAGE_MAP(COLEDBDepartmentMFCApp, CWinApp)
  17. //{{AFX_MSG_MAP(COLEDBDepartmentMFCApp)
  18. ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
  19. // NOTE - the ClassWizard will add and remove mapping macros here.
  20. //    DO NOT EDIT what you see in these blocks of generated code!
  21. //}}AFX_MSG_MAP
  22. // Standard file based document commands
  23. ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
  24. ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
  25. END_MESSAGE_MAP()
  26. /////////////////////////////////////////////////////////////////////////////
  27. // COLEDBDepartmentMFCApp construction
  28. COLEDBDepartmentMFCApp::COLEDBDepartmentMFCApp()
  29. {
  30. // TODO: add construction code here,
  31. // Place all significant initialization in InitInstance
  32. }
  33. /////////////////////////////////////////////////////////////////////////////
  34. // The one and only COLEDBDepartmentMFCApp object
  35. COLEDBDepartmentMFCApp theApp;
  36. /////////////////////////////////////////////////////////////////////////////
  37. // COLEDBDepartmentMFCApp initialization
  38. BOOL COLEDBDepartmentMFCApp::InitInstance()
  39. {
  40. CoInitialize(NULL);
  41. AfxEnableControlContainer();
  42. // Standard initialization
  43. // If you are not using these features and wish to reduce the size
  44. //  of your final executable, you should remove from the following
  45. //  the specific initialization routines you do not need.
  46. #ifdef _AFXDLL
  47. Enable3dControls(); // Call this when using MFC in a shared DLL
  48. #else
  49. Enable3dControlsStatic(); // Call this when linking to MFC statically
  50. #endif
  51. // Change the registry key under which our settings are stored.
  52. // TODO: You should modify this string to be something appropriate
  53. // such as the name of your company or organization.
  54. SetRegistryKey(_T("Local AppWizard-Generated Applications"));
  55. LoadStdProfileSettings();  // Load standard INI file options (including MRU)
  56. // Register the application's document templates.  Document templates
  57. //  serve as the connection between documents, frame windows and views.
  58. CSingleDocTemplate* pDocTemplate;
  59. pDocTemplate = new CSingleDocTemplate(
  60. IDR_MAINFRAME,
  61. RUNTIME_CLASS(COLEDBDepartmentMFCDoc),
  62. RUNTIME_CLASS(CMainFrame),       // main SDI frame window
  63. RUNTIME_CLASS(COLEDBDepartmentMFCView));
  64. AddDocTemplate(pDocTemplate);
  65. // Parse command line for standard shell commands, DDE, file open
  66. CCommandLineInfo cmdInfo;
  67. ParseCommandLine(cmdInfo);
  68. // Dispatch commands specified on the command line
  69. if (!ProcessShellCommand(cmdInfo))
  70. return FALSE;
  71. // The one and only window has been initialized, so show and update it.
  72. m_pMainWnd->ShowWindow(SW_SHOW);
  73. m_pMainWnd->UpdateWindow();
  74. return TRUE;
  75. }
  76. /////////////////////////////////////////////////////////////////////////////
  77. // CAboutDlg dialog used for App About
  78. class CAboutDlg : public CDialog
  79. {
  80. public:
  81. CAboutDlg();
  82. // Dialog Data
  83. //{{AFX_DATA(CAboutDlg)
  84. enum { IDD = IDD_ABOUTBOX };
  85. //}}AFX_DATA
  86. // ClassWizard generated virtual function overrides
  87. //{{AFX_VIRTUAL(CAboutDlg)
  88. protected:
  89. virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
  90. //}}AFX_VIRTUAL
  91. // Implementation
  92. protected:
  93. //{{AFX_MSG(CAboutDlg)
  94. // No message handlers
  95. //}}AFX_MSG
  96. DECLARE_MESSAGE_MAP()
  97. };
  98. CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
  99. {
  100. //{{AFX_DATA_INIT(CAboutDlg)
  101. //}}AFX_DATA_INIT
  102. }
  103. void CAboutDlg::DoDataExchange(CDataExchange* pDX)
  104. {
  105. CDialog::DoDataExchange(pDX);
  106. //{{AFX_DATA_MAP(CAboutDlg)
  107. //}}AFX_DATA_MAP
  108. }
  109. BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
  110. //{{AFX_MSG_MAP(CAboutDlg)
  111. // No message handlers
  112. //}}AFX_MSG_MAP
  113. END_MESSAGE_MAP()
  114. // App command to run the dialog
  115. void COLEDBDepartmentMFCApp::OnAppAbout()
  116. {
  117. CAboutDlg aboutDlg;
  118. aboutDlg.DoModal();
  119. }
  120. /////////////////////////////////////////////////////////////////////////////
  121. // COLEDBDepartmentMFCApp message handlers