home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / mfc / ole / drawcli / mainfrm.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1998-03-27  |  2.7 KB  |  109 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.  
  14. #include "stdafx.h"
  15. #include "drawcli.h"
  16.  
  17. #include "mainfrm.h"
  18.  
  19. #ifdef _DEBUG
  20. #undef THIS_FILE
  21. static char BASED_CODE 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 BASED_CODE 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. CMainFrame::~CMainFrame()
  54. {
  55. }
  56.  
  57. int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
  58. {
  59.     if (CMDIFrameWnd::OnCreate(lpCreateStruct) == -1)
  60.         return -1;
  61.  
  62.     if (!m_wndToolBar.Create(this) ||
  63.         !m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
  64.     {
  65.         TRACE0("Failed to create toolbar\n");
  66.         return -1;      // fail to create
  67.     }
  68.  
  69.     if (!m_wndStatusBar.Create(this) ||
  70.         !m_wndStatusBar.SetIndicators(indicators,
  71.           sizeof(indicators)/sizeof(UINT)))
  72.     {
  73.         TRACE0("Failed to create status bar\n");
  74.         return -1;      // fail to create
  75.     }
  76.  
  77.     // TODO: Delete these three lines if you don't want the toolbar to
  78.     //  be dockable
  79.     m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
  80.     EnableDocking(CBRS_ALIGN_ANY);
  81.     DockControlBar(&m_wndToolBar);
  82.  
  83.     // TODO: Remove this if you don't want tool tips
  84.     m_wndToolBar.SetBarStyle(m_wndToolBar.GetBarStyle() |
  85.         CBRS_TOOLTIPS | CBRS_FLYBY);
  86.  
  87.     return 0;
  88. }
  89.  
  90.  
  91. /////////////////////////////////////////////////////////////////////////////
  92. // CMainFrame diagnostics
  93.  
  94. #ifdef _DEBUG
  95. void CMainFrame::AssertValid() const
  96. {
  97.     CMDIFrameWnd::AssertValid();
  98. }
  99.  
  100. void CMainFrame::Dump(CDumpContext& dc) const
  101. {
  102.     CMDIFrameWnd::Dump(dc);
  103. }
  104.  
  105. #endif //_DEBUG
  106.  
  107. /////////////////////////////////////////////////////////////////////////////
  108. // CMainFrame message handlers
  109.