tab_dlg_bar.cpp
上传用户:ledjyj
上传日期:2019-03-13
资源大小:36k
文件大小:4k
源码类别:

工具条

开发平台:

Visual C++

  1. // tab_dlg_bar.cpp : Defines the class behaviors for the application.
  2. //
  3. #include "stdafx.h"
  4. #include "tab_dlg_bar.h"
  5. #include "MainFrm.h"
  6. #include "ChildFrm.h"
  7. #include "tab_dlg_barDoc.h"
  8. #include "tab_dlg_barView.h"
  9. #ifdef _DEBUG
  10. #define new DEBUG_NEW
  11. #endif
  12. // Ctab_dlg_barApp
  13. BEGIN_MESSAGE_MAP(Ctab_dlg_barApp, CWinApp)
  14. ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
  15. // Standard file based document commands
  16. ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
  17. ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
  18. // Standard print setup command
  19. ON_COMMAND(ID_FILE_PRINT_SETUP, CWinApp::OnFilePrintSetup)
  20. END_MESSAGE_MAP()
  21. // Ctab_dlg_barApp construction
  22. Ctab_dlg_barApp::Ctab_dlg_barApp()
  23. {
  24. // EnableHtmlHelp();
  25. // TODO: add construction code here,
  26. // Place all significant initialization in InitInstance
  27. }
  28. // The one and only Ctab_dlg_barApp object
  29. Ctab_dlg_barApp theApp;
  30. // Ctab_dlg_barApp initialization
  31. BOOL Ctab_dlg_barApp::InitInstance()
  32. {
  33. // InitCommonControls() is required on Windows XP if an application
  34. // manifest specifies use of ComCtl32.dll version 6 or later to enable
  35. // visual styles.  Otherwise, any window creation will fail.
  36. InitCommonControls();
  37. CWinApp::InitInstance();
  38. // Initialize OLE libraries
  39. if (!AfxOleInit())
  40. {
  41. AfxMessageBox(IDP_OLE_INIT_FAILED);
  42. return FALSE;
  43. }
  44. AfxEnableControlContainer();
  45. // Standard initialization
  46. // If you are not using these features and wish to reduce the size
  47. // of your final executable, you should remove from the following
  48. // the specific initialization routines you do not need
  49. // Change the registry key under which our settings are stored
  50. // TODO: You should modify this string to be something appropriate
  51. // such as the name of your company or organization
  52. SetRegistryKey(_T("Local AppWizard-Generated Applications"));
  53. LoadStdProfileSettings(4);  // Load standard INI file options (including MRU)
  54. // Register the application's document templates.  Document templates
  55. //  serve as the connection between documents, frame windows and views
  56. CMultiDocTemplate* pDocTemplate;
  57. pDocTemplate = new CMultiDocTemplate(IDR_tab_dlg_barTYPE,
  58. RUNTIME_CLASS(Ctab_dlg_barDoc),
  59. RUNTIME_CLASS(CChildFrame), // custom MDI child frame
  60. RUNTIME_CLASS(Ctab_dlg_barView));
  61. if (!pDocTemplate)
  62. return FALSE;
  63. AddDocTemplate(pDocTemplate);
  64. // create main MDI Frame window
  65. CMainFrame* pMainFrame = new CMainFrame;
  66. if (!pMainFrame || !pMainFrame->LoadFrame(IDR_MAINFRAME))
  67. return FALSE;
  68. m_pMainWnd = pMainFrame;
  69. // call DragAcceptFiles only if there's a suffix
  70. //  In an MDI app, this should occur immediately after setting m_pMainWnd
  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.  Will return FALSE if
  75. // app was launched with /RegServer, /Register, /Unregserver or /Unregister.
  76. if (!ProcessShellCommand(cmdInfo))
  77. return FALSE;
  78. // The main window has been initialized, so show and update it
  79. pMainFrame->ShowWindow(m_nCmdShow);
  80. pMainFrame->UpdateWindow();
  81. return TRUE;
  82. }
  83. // CAboutDlg dialog used for App About
  84. class CAboutDlg : public CDialog
  85. {
  86. public:
  87. CAboutDlg();
  88. // Dialog Data
  89. enum { IDD = IDD_ABOUTBOX };
  90. protected:
  91. virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
  92. // Implementation
  93. protected:
  94. DECLARE_MESSAGE_MAP()
  95. };
  96. CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
  97. {
  98. }
  99. void CAboutDlg::DoDataExchange(CDataExchange* pDX)
  100. {
  101. CDialog::DoDataExchange(pDX);
  102. }
  103. BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
  104. END_MESSAGE_MAP()
  105. // App command to run the dialog
  106. void Ctab_dlg_barApp::OnAppAbout()
  107. {
  108. CAboutDlg aboutDlg;
  109. aboutDlg.DoModal();
  110. }
  111. // Ctab_dlg_barApp message handlers