MainFrm.cpp
上传用户:peony_8
上传日期:2022-05-18
资源大小:1955k
文件大小:2k
源码类别:

菜单

开发平台:

Visual C++

  1. // MainFrm.cpp : implementation of the CMainFrame class
  2. //
  3. #include "stdafx.h"
  4. #include "Prop.h"
  5. #include "MainFrm.h"
  6. #ifdef _DEBUG
  7. #define new DEBUG_NEW
  8. #undef THIS_FILE
  9. static char THIS_FILE[] = __FILE__;
  10. #endif
  11. /////////////////////////////////////////////////////////////////////////////
  12. // CMainFrame
  13. IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd)
  14. BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
  15. //{{AFX_MSG_MAP(CMainFrame)
  16. // NOTE - the ClassWizard will add and remove mapping macros here.
  17. //    DO NOT EDIT what you see in these blocks of generated code !
  18. ON_WM_CREATE()
  19. //}}AFX_MSG_MAP
  20. END_MESSAGE_MAP()
  21. static UINT indicators[] =
  22. {
  23. ID_SEPARATOR,           // status line indicator
  24. ID_INDICATOR_CAPS,
  25. ID_INDICATOR_NUM,
  26. ID_INDICATOR_SCRL,
  27. };
  28. /////////////////////////////////////////////////////////////////////////////
  29. // CMainFrame construction/destruction
  30. CMainFrame::CMainFrame()
  31. {
  32. // TODO: add member initialization code here
  33. }
  34. CMainFrame::~CMainFrame()
  35. {
  36. }
  37. int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
  38. {
  39. if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
  40. return -1;
  41. if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
  42. | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
  43. !m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
  44. {
  45. TRACE0("Failed to create toolbarn");
  46. return -1;      // fail to create
  47. }
  48. if (!m_wndStatusBar.Create(this) ||
  49. !m_wndStatusBar.SetIndicators(indicators,
  50.   sizeof(indicators)/sizeof(UINT)))
  51. {
  52. TRACE0("Failed to create status barn");
  53. return -1;      // fail to create
  54. }
  55. // TODO: Delete these three lines if you don't want the toolbar to
  56. //  be dockable
  57. m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
  58. EnableDocking(CBRS_ALIGN_ANY);
  59. DockControlBar(&m_wndToolBar);
  60. return 0;
  61. }
  62. BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
  63. {
  64. if( !CFrameWnd::PreCreateWindow(cs) )
  65. return FALSE;
  66. // TODO: Modify the Window class or styles here by modifying
  67. //  the CREATESTRUCT cs
  68. return TRUE;
  69. }
  70. /////////////////////////////////////////////////////////////////////////////
  71. // CMainFrame diagnostics
  72. #ifdef _DEBUG
  73. void CMainFrame::AssertValid() const
  74. {
  75. CFrameWnd::AssertValid();
  76. }
  77. void CMainFrame::Dump(CDumpContext& dc) const
  78. {
  79. CFrameWnd::Dump(dc);
  80. }
  81. #endif //_DEBUG
  82. /////////////////////////////////////////////////////////////////////////////
  83. // CMainFrame message handlers