MainFrm.cpp
上传用户:sun1608
上传日期:2007-02-02
资源大小:6116k
文件大小:3k
源码类别:

流媒体/Mpeg4/MP4

开发平台:

Visual C++

  1. // MainFrm.cpp : implementation of the CMainFrame class
  2. //
  3. #include "stdafx.h"
  4. #include "wmp4player.h"
  5. #include "MainFrm.h"
  6. #include <SDL.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. ON_WM_CREATE()
  18. ON_COMMAND(ID_PAGE_UP, OnPageUp)
  19. ON_COMMAND(ID_PAGE_DOWN, OnPageDown)
  20. ON_COMMAND(ID_SPACE, OnSpace)
  21. ON_COMMAND(ID_HOME, OnHome)
  22. ON_COMMAND(ID_END, OnEnd)
  23. //}}AFX_MSG_MAP
  24. // Global help commands
  25. ON_COMMAND(ID_HELP_FINDER, CFrameWnd::OnHelpFinder)
  26. ON_COMMAND(ID_HELP, CFrameWnd::OnHelp)
  27. ON_COMMAND(ID_CONTEXT_HELP, CFrameWnd::OnContextHelp)
  28. ON_COMMAND(ID_DEFAULT_HELP, CFrameWnd::OnHelpFinder)
  29. ON_MESSAGE(WM_CLOSED_SESSION, OnCloseSession)
  30. ON_MESSAGE(WM_SESSION_DIED, OnSessionDied)
  31. END_MESSAGE_MAP()
  32. static UINT indicators[] =
  33. {
  34. ID_SEPARATOR,           // status line indicator
  35. ID_INDICATOR_CAPS,
  36. ID_INDICATOR_NUM,
  37. ID_INDICATOR_SCRL,
  38. };
  39. /////////////////////////////////////////////////////////////////////////////
  40. // CMainFrame construction/destruction
  41. CMainFrame::CMainFrame()
  42. {
  43. // TODO: add member initialization code here
  44. }
  45. CMainFrame::~CMainFrame()
  46. {
  47. }
  48. int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
  49. {
  50. if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
  51. return -1;
  52. if (!m_wndStatusBar.Create(this) ||
  53. !m_wndStatusBar.SetIndicators(indicators,
  54.   sizeof(indicators)/sizeof(UINT)))
  55. {
  56. TRACE0("Failed to create status barn");
  57. return -1;      // fail to create
  58. }
  59. return 0;
  60. }
  61. BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
  62. {
  63. if( !CFrameWnd::PreCreateWindow(cs) )
  64. return FALSE;
  65. // TODO: Modify the Window class or styles here by modifying
  66. //  the CREATESTRUCT cs
  67. return TRUE;
  68. }
  69. void CMainFrame::OnCloseSession (void)
  70. {
  71. theApp.StopSession();
  72. }
  73. void CMainFrame::OnSessionDied (void)
  74. {
  75. theApp.SessionDied();
  76. }
  77. /////////////////////////////////////////////////////////////////////////////
  78. // CMainFrame diagnostics
  79. #ifdef _DEBUG
  80. void CMainFrame::AssertValid() const
  81. {
  82. CFrameWnd::AssertValid();
  83. }
  84. void CMainFrame::Dump(CDumpContext& dc) const
  85. {
  86. CFrameWnd::Dump(dc);
  87. }
  88. #endif //_DEBUG
  89. /////////////////////////////////////////////////////////////////////////////
  90. // CMainFrame message handlers
  91. void CMainFrame::OnPageUp() 
  92. {
  93. GetActiveView()->PostMessage(WM_SDL_KEY, SDLK_PAGEUP, 0);
  94. }
  95. void CMainFrame::OnPageDown() 
  96. {
  97. GetActiveView()->PostMessage(WM_SDL_KEY, SDLK_PAGEDOWN, 0);
  98. }
  99. void CMainFrame::OnSpace() 
  100. {
  101. GetActiveView()->PostMessage(WM_SDL_KEY, SDLK_SPACE, 0);
  102. }
  103. void CMainFrame::OnHome() 
  104. {
  105. GetActiveView()->PostMessage(WM_SDL_KEY, SDLK_HOME, 0);
  106. }
  107. void CMainFrame::OnEnd() 
  108. {
  109. GetActiveView()->PostMessage(WM_SDL_KEY, SDLK_END, 0);
  110. }