home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / com / dcom / atldraw / mainfrm.cpp < prev    next >
C/C++ Source or Header  |  1998-04-02  |  3KB  |  116 lines

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