DialogbarDemo.cpp
上传用户:lxjxxg
上传日期:2007-01-02
资源大小:42k
文件大小:4k
源码类别:

工具条

开发平台:

Visual C++

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