home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / mfc / database / catalog / mainfrm.cpp < prev    next >
C/C++ Source or Header  |  1998-03-26  |  3KB  |  121 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 "catalog.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_DYNCREATE(CMainFrame, CFrameWnd)
  28.  
  29. BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
  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. /////////////////////////////////////////////////////////////////////////////
  38. // arrays of IDs used to initialize control bars
  39.  
  40. // toolbar buttons - IDs are command buttons
  41. static UINT BASED_CODE buttons[] =
  42. {
  43.     // same order as in the bitmap 'toolbar.bmp'
  44.     ID_EDIT_CUT,
  45.     ID_EDIT_COPY,
  46.     ID_EDIT_PASTE,
  47.         ID_SEPARATOR,
  48.     ID_FILE_PRINT,
  49.         ID_SEPARATOR,
  50.     ID_RECORD_FIRST,
  51.     ID_RECORD_PREV,
  52.     ID_RECORD_NEXT,
  53.     ID_RECORD_LAST,
  54.         ID_SEPARATOR,
  55.     ID_APP_ABOUT,
  56. };
  57.  
  58. static UINT BASED_CODE indicators[] =
  59. {
  60.     ID_SEPARATOR,           // status line indicator
  61.     ID_INDICATOR_CAPS,
  62.     ID_INDICATOR_NUM,
  63.     ID_INDICATOR_SCRL,
  64. };
  65.  
  66. /////////////////////////////////////////////////////////////////////////////
  67. // CMainFrame construction/destruction
  68.  
  69. CMainFrame::CMainFrame()
  70. {
  71.     // TODO: add member initialization code here
  72. }
  73.  
  74. CMainFrame::~CMainFrame()
  75. {
  76. }
  77.  
  78. int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
  79. {
  80.     if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
  81.         return -1;
  82.  
  83.     if (!m_wndToolBar.Create(this) ||
  84.         !m_wndToolBar.LoadBitmap(IDR_MAINFRAME) ||
  85.         !m_wndToolBar.SetButtons(buttons,
  86.           sizeof(buttons)/sizeof(UINT)))
  87.     {
  88.         TRACE("Failed to create toolbar\n");
  89.         return -1;      // fail to create
  90.     }
  91.  
  92.     if (!m_wndStatusBar.Create(this) ||
  93.         !m_wndStatusBar.SetIndicators(indicators,
  94.           sizeof(indicators)/sizeof(UINT)))
  95.     {
  96.         TRACE("Failed to create status bar\n");
  97.         return -1;      // fail to create
  98.     }
  99.  
  100.     return 0;
  101. }
  102.  
  103. /////////////////////////////////////////////////////////////////////////////
  104. // CMainFrame diagnostics
  105.  
  106. #ifdef _DEBUG
  107. void CMainFrame::AssertValid() const
  108. {
  109.     CFrameWnd::AssertValid();
  110. }
  111.  
  112. void CMainFrame::Dump(CDumpContext& dc) const
  113. {
  114.     CFrameWnd::Dump(dc);
  115. }
  116.  
  117. #endif //_DEBUG
  118.  
  119. /////////////////////////////////////////////////////////////////////////////
  120. // CMainFrame message handlers
  121.