home *** CD-ROM | disk | FTP | other *** search
/ Using Visual C++ 4 (Special Edition) / Using_Visual_C_4_Special_Edition_QUE_1996.iso / ch05 / mainfrm.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1995-09-18  |  2.7 KB  |  113 lines

  1. // MainFrm.cpp : implementation of the CMainFrame class
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "FileView.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.         // 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.     // Global help commands
  27.     ON_COMMAND(ID_HELP_FINDER, CMDIFrameWnd::OnHelpFinder)
  28.     ON_COMMAND(ID_HELP, CMDIFrameWnd::OnHelp)
  29.     ON_COMMAND(ID_CONTEXT_HELP, CMDIFrameWnd::OnContextHelp)
  30.     ON_COMMAND(ID_DEFAULT_HELP, CMDIFrameWnd::OnHelpFinder)
  31. END_MESSAGE_MAP()
  32.  
  33. static UINT indicators[] =
  34. {
  35.     ID_SEPARATOR,           // status line indicator
  36.     ID_INDICATOR_CAPS,
  37.     ID_INDICATOR_NUM,
  38.     ID_INDICATOR_SCRL,
  39. };
  40.  
  41. /////////////////////////////////////////////////////////////////////////////
  42. // CMainFrame construction/destruction
  43.  
  44. CMainFrame::CMainFrame()
  45. {
  46.     // TODO: add member initialization code here
  47.     
  48. }
  49.  
  50. CMainFrame::~CMainFrame()
  51. {
  52. }
  53.  
  54. int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
  55. {
  56.     if (CMDIFrameWnd::OnCreate(lpCreateStruct) == -1)
  57.         return -1;
  58.     
  59.     if (!m_wndToolBar.Create(this) ||
  60.         !m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
  61.     {
  62.         TRACE0("Failed to create toolbar\n");
  63.         return -1;      // fail to create
  64.     }
  65.  
  66.     if (!m_wndStatusBar.Create(this) ||
  67.         !m_wndStatusBar.SetIndicators(indicators,
  68.           sizeof(indicators)/sizeof(UINT)))
  69.     {
  70.         TRACE0("Failed to create status bar\n");
  71.         return -1;      // fail to create
  72.     }
  73.  
  74.     // TODO: Remove this if you don't want tool tips or a resizeable toolbar
  75.     m_wndToolBar.SetBarStyle(m_wndToolBar.GetBarStyle() |
  76.         CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC);
  77.  
  78.     // TODO: Delete these three lines if you don't want the toolbar to
  79.     //  be dockable
  80.     m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
  81.     EnableDocking(CBRS_ALIGN_ANY);
  82.     DockControlBar(&m_wndToolBar);
  83.  
  84.     return 0;
  85. }
  86.  
  87. BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
  88. {
  89.     // TODO: Modify the Window class or styles here by modifying
  90.     //  the CREATESTRUCT cs
  91.  
  92.     return CMDIFrameWnd::PreCreateWindow(cs);
  93. }
  94.  
  95. /////////////////////////////////////////////////////////////////////////////
  96. // CMainFrame diagnostics
  97.  
  98. #ifdef _DEBUG
  99. void CMainFrame::AssertValid() const
  100. {
  101.     CMDIFrameWnd::AssertValid();
  102. }
  103.  
  104. void CMainFrame::Dump(CDumpContext& dc) const
  105. {
  106.     CMDIFrameWnd::Dump(dc);
  107. }
  108.  
  109. #endif //_DEBUG
  110.  
  111. /////////////////////////////////////////////////////////////////////////////
  112. // CMainFrame message handlers
  113.