home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / mfc / general / snapvw / mainfrm.cpp < prev    next >
C/C++ Source or Header  |  1998-03-26  |  3KB  |  117 lines

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