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