MainFrm.cpp
Upload User: chennaikun
Upload Date: 2022-05-07
Package Size: 2328k
Code Size: 2k
Category:

Dialog_Window

Development Platform:

Visual C++

  1. // MainFrm.cpp : implementation of the CMainFrame class
  2. //
  3. #include "stdafx.h"
  4. #include "testdl.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. ON_WM_CREATE()
  17. ON_COMMAND(ID_EDIT_TEST, OnEditTest)
  18. //}}AFX_MSG_MAP
  19. END_MESSAGE_MAP()
  20. static UINT indicators[] =
  21. {
  22. ID_SEPARATOR,           // status line indicator
  23. ID_INDICATOR_CAPS,
  24. ID_INDICATOR_NUM,
  25. ID_INDICATOR_SCRL,
  26. };
  27. /////////////////////////////////////////////////////////////////////////////
  28. // CMainFrame construction/destruction
  29. CMainFrame::CMainFrame()
  30. {
  31. // TODO: add member initialization code here
  32. }
  33. CMainFrame::~CMainFrame()
  34. {
  35. }
  36. int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
  37. {
  38. if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
  39. return -1;
  40. if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
  41. | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
  42. !m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
  43. {
  44. TRACE0("Failed to create toolbarn");
  45. return -1;      // fail to create
  46. }
  47. if (!m_wndStatusBar.Create(this) ||
  48. !m_wndStatusBar.SetIndicators(indicators,
  49.   sizeof(indicators)/sizeof(UINT)))
  50. {
  51. TRACE0("Failed to create status barn");
  52. return -1;      // fail to create
  53. }
  54. // TODO: Delete these three lines if you don't want the toolbar to
  55. //  be dockable
  56. m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
  57. EnableDocking(CBRS_ALIGN_ANY);
  58. DockControlBar(&m_wndToolBar);
  59. return 0;
  60. }
  61. BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
  62. {
  63. if( !CFrameWnd::PreCreateWindow(cs) )
  64. return FALSE;
  65. // TODO: Modify the Window class or styles here by modifying
  66. //  the CREATESTRUCT cs
  67. return TRUE;
  68. }
  69. /////////////////////////////////////////////////////////////////////////////
  70. // CMainFrame diagnostics
  71. #ifdef _DEBUG
  72. void CMainFrame::AssertValid() const
  73. {
  74. CFrameWnd::AssertValid();
  75. }
  76. void CMainFrame::Dump(CDumpContext& dc) const
  77. {
  78. CFrameWnd::Dump(dc);
  79. }
  80. #endif //_DEBUG
  81. /////////////////////////////////////////////////////////////////////////////
  82. // CMainFrame message handlers
  83. void CMainFrame::OnEditTest() 
  84. {
  85. // TODO: Add your command handler code here
  86. }