MainFrm.cpp 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. // MainFrm.cpp : implementation of the CMainFrame class
  2. //
  3. #include "stdafx.h"
  4. #include "Demo.h"
  5. #include "MainFrm.h"
  6. #ifdef _DEBUG
  7. #define new DEBUG_NEW
  8. #undef THIS_FILE
  9. static char THIS_FILE[] = __FILE__;
  10. #endif
  11. /////////////////////////////////////////////////////////////////////////////
  12. // CMainFrame
  13. IMPLEMENT_DYNAMIC(CMainFrame, CResizableMDIFrame)
  14. BEGIN_MESSAGE_MAP(CMainFrame, CResizableMDIFrame)
  15. //{{AFX_MSG_MAP(CMainFrame)
  16. ON_WM_CREATE()
  17. //}}AFX_MSG_MAP
  18. END_MESSAGE_MAP()
  19. static UINT indicators[] =
  20. {
  21. ID_SEPARATOR, // status line indicator
  22. ID_INDICATOR_CAPS,
  23. ID_INDICATOR_NUM,
  24. ID_INDICATOR_SCRL,
  25. };
  26. /////////////////////////////////////////////////////////////////////////////
  27. // CMainFrame construction/destruction
  28. CMainFrame::CMainFrame()
  29. {
  30. }
  31. CMainFrame::~CMainFrame()
  32. {
  33. }
  34. int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
  35. {
  36. if (CResizableMDIFrame::OnCreate(lpCreateStruct) == -1)
  37. return -1;
  38. if (!m_wndStatusBar.Create(this) ||
  39. !m_wndStatusBar.SetIndicators(indicators,
  40. sizeof(indicators)/sizeof(UINT)))
  41. {
  42. TRACE0("Failed to create status bar\n");
  43. return -1; // fail to create
  44. }
  45. return 0;
  46. }
  47. BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
  48. {
  49. if( !CResizableMDIFrame::PreCreateWindow(cs) )
  50. return FALSE;
  51. return TRUE;
  52. }
  53. /////////////////////////////////////////////////////////////////////////////
  54. // CMainFrame diagnostics
  55. #ifdef _DEBUG
  56. void CMainFrame::AssertValid() const
  57. {
  58. CResizableMDIFrame::AssertValid();
  59. }
  60. void CMainFrame::Dump(CDumpContext& dc) const
  61. {
  62. CResizableMDIFrame::Dump(dc);
  63. }
  64. #endif //_DEBUG
  65. /////////////////////////////////////////////////////////////////////////////
  66. // CMainFrame message handlers
  67. void CMainFrame::ActivateFrame(int nCmdShow)
  68. {
  69. if ( EnableSaveRestore(_T("Demo MDI MainFrame")) )
  70. {
  71. // if correctly restored, activate window and return
  72. SetActiveWindow();
  73. return;
  74. }
  75. CResizableMDIFrame::ActivateFrame(nCmdShow);
  76. }