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

书籍源码

开发平台:

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. //}}AFX_MSG_MAP
  20. END_MESSAGE_MAP()
  21. /////////////////////////////////////////////////////////////////////////////
  22. // COLEDBDepartmentMFCApp construction
  23. COLEDBDepartmentMFCApp::COLEDBDepartmentMFCApp()
  24. {
  25. }
  26. /////////////////////////////////////////////////////////////////////////////
  27. // The one and only COLEDBDepartmentMFCApp object
  28. COLEDBDepartmentMFCApp theApp;
  29. /////////////////////////////////////////////////////////////////////////////
  30. // COLEDBDepartmentMFCApp initialization
  31. BOOL COLEDBDepartmentMFCApp::InitInstance()
  32. {
  33. CoInitialize(NULL);
  34. AfxEnableControlContainer();
  35. // Standard initialization
  36. #ifdef _AFXDLL
  37. Enable3dControls(); // Call this when using MFC in a shared DLL
  38. #else
  39. Enable3dControlsStatic(); // Call this when linking to MFC statically
  40. #endif
  41. // Change the registry key under which our settings are stored.
  42. SetRegistryKey(_T("Local AppWizard-Generated Applications"));
  43. LoadStdProfileSettings();  // Load standard INI file options (including MRU)
  44. // Register document templates
  45. CSingleDocTemplate* pDocTemplate;
  46. pDocTemplate = new CSingleDocTemplate(
  47. IDR_MAINFRAME,
  48. RUNTIME_CLASS(COLEDBDepartmentMFCDoc),
  49. RUNTIME_CLASS(CMainFrame),       // main SDI frame window
  50. RUNTIME_CLASS(COLEDBDepartmentMFCView));
  51. AddDocTemplate(pDocTemplate);
  52. // Parse command line for standard shell commands, DDE, file open
  53. CCommandLineInfo cmdInfo;
  54. ParseCommandLine(cmdInfo);
  55. // Dispatch commands specified on the command line
  56. if (!ProcessShellCommand(cmdInfo))
  57. return FALSE;
  58. m_pMainWnd->ShowWindow(SW_SHOW);
  59. m_pMainWnd->UpdateWindow();
  60. return TRUE;
  61. }
  62. /////////////////////////////////////////////////////////////////////////////
  63. // CAboutDlg dialog used for App About
  64. class CAboutDlg : public CDialog
  65. {
  66. public:
  67. CAboutDlg();
  68. // Dialog Data
  69. //{{AFX_DATA(CAboutDlg)
  70. enum { IDD = IDD_ABOUTBOX };
  71. //}}AFX_DATA
  72. // ClassWizard generated virtual function overrides
  73. //{{AFX_VIRTUAL(CAboutDlg)
  74. protected:
  75. virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
  76. //}}AFX_VIRTUAL
  77. // Implementation
  78. protected:
  79. //{{AFX_MSG(CAboutDlg)
  80. // No message handlers
  81. //}}AFX_MSG
  82. DECLARE_MESSAGE_MAP()
  83. };
  84. CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
  85. {
  86. //{{AFX_DATA_INIT(CAboutDlg)
  87. //}}AFX_DATA_INIT
  88. }
  89. void CAboutDlg::DoDataExchange(CDataExchange* pDX)
  90. {
  91. CDialog::DoDataExchange(pDX);
  92. //{{AFX_DATA_MAP(CAboutDlg)
  93. //}}AFX_DATA_MAP
  94. }
  95. BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
  96. //{{AFX_MSG_MAP(CAboutDlg)
  97. // No message handlers
  98. //}}AFX_MSG_MAP
  99. END_MESSAGE_MAP()
  100. // App command to run the dialog
  101. void COLEDBDepartmentMFCApp::OnAppAbout()
  102. {
  103. CAboutDlg aboutDlg;
  104. aboutDlg.DoModal();
  105. }
  106. /////////////////////////////////////////////////////////////////////////////
  107. // COLEDBDepartmentMFCApp message handlers