MainFrm.cpp
上传用户:dzyhzl
上传日期:2019-04-29
资源大小:56270k
文件大小:3k
源码类别:

模拟服务器

开发平台:

C/C++

  1. // MainFrm.cpp : implementation of the CMainFrame class
  2. //
  3. #include "stdafx.h"
  4. #include "HostApp.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. }
  35. CMainFrame::~CMainFrame()
  36. {
  37. }
  38. int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
  39. {
  40.     if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
  41.         return -1;
  42.     
  43.     if (!m_wndToolBar.Create(this) ||
  44.         !m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
  45.     {
  46.         TRACE0("Failed to create toolbarn");
  47.         return -1;      // fail to create
  48.     }
  49.     if (!m_wndStatusBar.Create(this) ||
  50.         !m_wndStatusBar.SetIndicators(indicators,
  51.           sizeof(indicators)/sizeof(UINT)))
  52.     {
  53.         TRACE0("Failed to create status barn");
  54.         return -1;      // fail to create
  55.     }
  56.     // TODO: Remove this if you don't want tool tips or a resizeable toolbar
  57.     m_wndToolBar.SetBarStyle(m_wndToolBar.GetBarStyle() |
  58.         CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC);
  59.     // TODO: Delete these three lines if you don't want the toolbar to
  60.     //  be dockable
  61.     m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
  62.     EnableDocking(CBRS_ALIGN_ANY);
  63.     DockControlBar(&m_wndToolBar);
  64.     return 0;
  65. }
  66. BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
  67. {
  68.     // TODO: Modify the Window class or styles here by modifying
  69.     //  the CREATESTRUCT cs
  70.     return CFrameWnd::PreCreateWindow(cs);
  71. }
  72. /////////////////////////////////////////////////////////////////////////////
  73. // CMainFrame diagnostics
  74. #ifdef _DEBUG
  75. void CMainFrame::AssertValid() const
  76. {
  77.     CFrameWnd::AssertValid();
  78. }
  79. void CMainFrame::Dump(CDumpContext& dc) const
  80. {
  81.     CFrameWnd::Dump(dc);
  82. }
  83. #endif //_DEBUG
  84. /////////////////////////////////////////////////////////////////////////////
  85. // CMainFrame message handlers