home *** CD-ROM | disk | FTP | other *** search
/ Mastering MFC Development / MMD.ISO / labs / c10 / lab01 / ex04 / mainfrm.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1997-02-20  |  2.4 KB  |  109 lines

  1. // MainFrm.cpp : implementation of the CMainFrame class
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "Browser.h"
  6.  
  7. #include "MainFrm.h"
  8.  
  9. #ifdef _DEBUG
  10. #define new DEBUG_NEW
  11. #undef THIS_FILE
  12. static char THIS_FILE[] = __FILE__;
  13. #endif
  14.  
  15. /////////////////////////////////////////////////////////////////////////////
  16. // CMainFrame
  17.  
  18. IMPLEMENT_DYNAMIC(CMainFrame, CMDIFrameWnd)
  19.  
  20. BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWnd)
  21.     //{{AFX_MSG_MAP(CMainFrame)
  22.     ON_WM_CREATE()
  23.     //}}AFX_MSG_MAP
  24. END_MESSAGE_MAP()
  25.  
  26. static UINT indicators[] =
  27. {
  28.     ID_SEPARATOR,           // status line indicator
  29.     ID_INDICATOR_CAPS,
  30.     ID_INDICATOR_NUM,
  31.     ID_INDICATOR_SCRL,
  32. };
  33.  
  34. /////////////////////////////////////////////////////////////////////////////
  35. // CMainFrame construction/destruction
  36.  
  37. CMainFrame::CMainFrame()
  38. {
  39.     // TODO: add member initialization code here
  40.     
  41. }
  42.  
  43. CMainFrame::~CMainFrame()
  44. {
  45. }
  46.  
  47. int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
  48. {
  49.     if (CMDIFrameWnd::OnCreate(lpCreateStruct) == -1)
  50.         return -1;
  51.     
  52.     if (!m_wndToolBar.Create(this) ||
  53.         !m_wndToolBar.LoadToolBar(IDR_MAINFRAME) )
  54.     {
  55.         TRACE0("Failed to create toolbar\n");
  56.         return -1;      // fail to create
  57.     }
  58.     
  59.     if (!m_wndStatusBar.Create(this) ||
  60.         !m_wndStatusBar.SetIndicators(indicators,
  61.           sizeof(indicators)/sizeof(UINT)))
  62.     {
  63.         TRACE0("Failed to create status bar\n");
  64.         return -1;      // fail to create
  65.     }
  66.  
  67.     // TODO: Remove this if you don't want tool tips or a resizeable toolbar
  68.     m_wndToolBar.SetBarStyle(m_wndToolBar.GetBarStyle() |
  69.         CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC);
  70.  
  71.  
  72.     // TODO: Delete these three lines if you don't want the toolbar to
  73.     //  be dockable
  74.     m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
  75.     EnableDocking(CBRS_ALIGN_ANY);
  76.     DockControlBar(&m_wndToolBar);
  77.  
  78.     return 0;
  79. }
  80.  
  81. BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
  82. {
  83.     // TODO: Modify the Window class or styles here by modifying
  84.     //  the CREATESTRUCT cs
  85.  
  86.     return CMDIFrameWnd::PreCreateWindow(cs);
  87. }
  88.  
  89. /////////////////////////////////////////////////////////////////////////////
  90. // CMainFrame diagnostics
  91.  
  92. #ifdef _DEBUG
  93. void CMainFrame::AssertValid() const
  94. {
  95.     CMDIFrameWnd::AssertValid();
  96. }
  97.  
  98. void CMainFrame::Dump(CDumpContext& dc) const
  99. {
  100.     CMDIFrameWnd::Dump(dc);
  101. }
  102.  
  103. #endif //_DEBUG
  104.  
  105. /////////////////////////////////////////////////////////////////////////////
  106. // CMainFrame message handlers
  107.  
  108.  
  109.