CTreeControlBar.cpp
上传用户:nbkytg
上传日期:2021-02-14
资源大小:126k
文件大小:5k
源码类别:

工具条

开发平台:

Visual C++

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