MainFrm.cpp 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. //Download by http://www.NewXing.com
  2. // MainFrm.cpp : implementation of the CMainFrame class
  3. //
  4. #include "stdafx.h"
  5. #include "WalkLtDemo.h"
  6. #include "MainFrm.h"
  7. #ifdef _DEBUG
  8. #define new DEBUG_NEW
  9. #undef THIS_FILE
  10. static char THIS_FILE[] = __FILE__;
  11. #endif
  12. /////////////////////////////////////////////////////////////////////////////
  13. // CMainFrame
  14. IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd)
  15. BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
  16. //{{AFX_MSG_MAP(CMainFrame)
  17. // NOTE - the ClassWizard will add and remove mapping macros here.
  18. // DO NOT EDIT what you see in these blocks of generated code !
  19. ON_WM_CREATE()
  20. //}}AFX_MSG_MAP
  21. END_MESSAGE_MAP()
  22. static UINT indicators[] =
  23. {
  24. ID_SEPARATOR, // status line indicator
  25. ID_INDICATOR_CAPS,
  26. ID_INDICATOR_NUM,
  27. ID_INDICATOR_SCRL,
  28. };
  29. /////////////////////////////////////////////////////////////////////////////
  30. // CMainFrame construction/destruction
  31. CMainFrame::CMainFrame()
  32. {
  33. // TODO: add member initialization code here
  34. }
  35. CMainFrame::~CMainFrame()
  36. {
  37. }
  38. int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
  39. {
  40. if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
  41. return -1;
  42. if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
  43. | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
  44. !m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
  45. {
  46. TRACE0("Failed to create toolbar\n");
  47. return -1; // fail to create
  48. }
  49. if (!m_wndStatusBar.Create(this) ||
  50. !m_wndStatusBar.SetIndicators(indicators,
  51. sizeof(indicators)/sizeof(UINT)))
  52. {
  53. TRACE0("Failed to create status bar\n");
  54. return -1; // fail to create
  55. }
  56. // TODO: Delete these three lines if you don't want the toolbar to
  57. // be dockable
  58. m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
  59. EnableDocking(CBRS_ALIGN_ANY);
  60. DockControlBar(&m_wndToolBar);
  61. return 0;
  62. }
  63. BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
  64. {
  65. if( !CFrameWnd::PreCreateWindow(cs) )
  66. return FALSE;
  67. // TODO: Modify the Window class or styles here by modifying
  68. // the CREATESTRUCT cs
  69. return TRUE;
  70. }
  71. /////////////////////////////////////////////////////////////////////////////
  72. // CMainFrame diagnostics
  73. #ifdef _DEBUG
  74. void CMainFrame::AssertValid() const
  75. {
  76. CFrameWnd::AssertValid();
  77. }
  78. void CMainFrame::Dump(CDumpContext& dc) const
  79. {
  80. CFrameWnd::Dump(dc);
  81. }
  82. #endif //_DEBUG
  83. /////////////////////////////////////////////////////////////////////////////
  84. // CMainFrame message handlers