home *** CD-ROM | disk | FTP | other *** search
/ Mastering MFC Development / MMD.ISO / samples / c05 / tool / mainfrm.cpp next >
Encoding:
C/C++ Source or Header  |  1997-02-20  |  2.1 KB  |  92 lines

  1. // MainFrm.cpp : implementation of the CMainFrame class
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "Tool.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_DYNCREATE(CMainFrame, CFrameWnd)
  19.  
  20. BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
  21.     //{{AFX_MSG_MAP(CMainFrame)
  22.         // NOTE - the ClassWizard will add and remove mapping macros here.
  23.         //    DO NOT EDIT what you see in these blocks of generated code !
  24.     ON_WM_CREATE()
  25.     //}}AFX_MSG_MAP
  26. END_MESSAGE_MAP()
  27.  
  28. /////////////////////////////////////////////////////////////////////////////
  29. // CMainFrame construction/destruction
  30.  
  31. CMainFrame::CMainFrame()
  32. {
  33.     // TODO: add member initialization code here
  34.     
  35. }
  36.  
  37. CMainFrame::~CMainFrame()
  38. {
  39. }
  40.  
  41. int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
  42. {
  43.     if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
  44.         return -1;
  45.     
  46.     if (!m_wndToolBar.Create(this) ||
  47.         !m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
  48.     {
  49.         TRACE0("Failed to create toolbar\n");
  50.         return -1;      // fail to create
  51.     }
  52.  
  53.     // TODO: Remove this if you don't want tool tips or a resizeable toolbar
  54.     m_wndToolBar.SetBarStyle(m_wndToolBar.GetBarStyle() |
  55.         CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC);
  56.  
  57.     // TODO: Delete these three lines if you don't want the toolbar to
  58.     //  be dockable
  59.     m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
  60.     EnableDocking(CBRS_ALIGN_ANY);
  61.     DockControlBar(&m_wndToolBar);
  62.  
  63.     return 0;
  64. }
  65.  
  66. BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
  67. {
  68.     // TODO: Modify the Window class or styles here by modifying
  69.     //  the CREATESTRUCT cs
  70.  
  71.     return CFrameWnd::PreCreateWindow(cs);
  72. }
  73.  
  74. /////////////////////////////////////////////////////////////////////////////
  75. // CMainFrame diagnostics
  76.  
  77. #ifdef _DEBUG
  78. void CMainFrame::AssertValid() const
  79. {
  80.     CFrameWnd::AssertValid();
  81. }
  82.  
  83. void CMainFrame::Dump(CDumpContext& dc) const
  84. {
  85.     CFrameWnd::Dump(dc);
  86. }
  87.  
  88. #endif //_DEBUG
  89.  
  90. /////////////////////////////////////////////////////////////////////////////
  91. // CMainFrame message handlers
  92.