home *** CD-ROM | disk | FTP | other *** search
/ Master Visual C++ 1.5 / MASTERVC15.ISO / vcprog / original / ch21 / mytool / mainfrm.cpp next >
Encoding:
C/C++ Source or Header  |  1994-01-26  |  2.5 KB  |  113 lines

  1. // mainfrm.cpp : implementation of the CMainFrame class
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "mytool.h"
  6.  
  7. #include "mainfrm.h"
  8.  
  9. #ifdef _DEBUG
  10. #undef THIS_FILE
  11. static char BASED_CODE THIS_FILE[] = __FILE__;
  12. #endif
  13.  
  14. /////////////////////////////////////////////////////////////////////////////
  15. // CMainFrame
  16.  
  17. IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd)
  18.  
  19. BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
  20.     //{{AFX_MSG_MAP(CMainFrame)
  21.         // NOTE - the ClassWizard will add and remove mapping macros here.
  22.         //    DO NOT EDIT what you see in these blocks of generated code !
  23.     ON_WM_CREATE()
  24.     //}}AFX_MSG_MAP
  25. END_MESSAGE_MAP()
  26.  
  27. /////////////////////////////////////////////////////////////////////////////
  28. // arrays of IDs used to initialize control bars
  29.  
  30. // toolbar buttons - IDs are command buttons
  31. static UINT BASED_CODE buttons[] =
  32. {
  33.     // same order as in the bitmap 'toolbar.bmp'
  34.  
  35.      //////////////////////
  36.      // MY CODE STARTS HERE
  37.      //////////////////////
  38.  
  39.      ID_TRYIT_MUSIC,
  40.      ID_TRYIT_MESSAGE,
  41.           ID_SEPARATOR,
  42.      ID_APP_ABOUT,
  43.  
  44.      ////////////////////
  45.      // MY CODE ENDS HERE
  46.      ////////////////////
  47.  
  48. };
  49.  
  50. static UINT BASED_CODE indicators[] =
  51. {
  52.     ID_SEPARATOR,           // status line indicator
  53.     ID_INDICATOR_CAPS,
  54.     ID_INDICATOR_NUM,
  55.     ID_INDICATOR_SCRL,
  56. };
  57.  
  58. /////////////////////////////////////////////////////////////////////////////
  59. // CMainFrame construction/destruction
  60.  
  61. CMainFrame::CMainFrame()
  62. {
  63.     // TODO: add member initialization code here
  64. }
  65.  
  66. CMainFrame::~CMainFrame()
  67. {
  68. }
  69.  
  70. int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
  71. {
  72.     if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
  73.         return -1;
  74.  
  75.     if (!m_wndToolBar.Create(this) ||
  76.         !m_wndToolBar.LoadBitmap(IDR_MAINFRAME) ||
  77.         !m_wndToolBar.SetButtons(buttons,
  78.           sizeof(buttons)/sizeof(UINT)))
  79.     {
  80.         TRACE("Failed to create toolbar\n");
  81.         return -1;      // fail to create
  82.     }
  83.  
  84.     if (!m_wndStatusBar.Create(this) ||
  85.         !m_wndStatusBar.SetIndicators(indicators,
  86.           sizeof(indicators)/sizeof(UINT)))
  87.     {
  88.         TRACE("Failed to create status bar\n");
  89.         return -1;      // fail to create
  90.     }
  91.  
  92.     return 0;
  93. }
  94.  
  95. /////////////////////////////////////////////////////////////////////////////
  96. // CMainFrame diagnostics
  97.  
  98. #ifdef _DEBUG
  99. void CMainFrame::AssertValid() const
  100. {
  101.     CFrameWnd::AssertValid();
  102. }
  103.  
  104. void CMainFrame::Dump(CDumpContext& dc) const
  105. {
  106.     CFrameWnd::Dump(dc);
  107. }
  108.  
  109. #endif //_DEBUG
  110.  
  111. /////////////////////////////////////////////////////////////////////////////
  112. // CMainFrame message handlers
  113.