00001
00002
00003
00004
00005
00006 #include "stdafx.h"
00007 #include "FdmApp.h"
00008 #include "VideoWindow.h"
00009
00010 #ifdef _DEBUG
00011 #define new DEBUG_NEW
00012 #undef THIS_FILE
00013 static char THIS_FILE[] = __FILE__;
00014 #endif
00015
00016 CVideoWindow::CVideoWindow()
00017 {
00018 }
00019
00020 CVideoWindow::~CVideoWindow()
00021 {
00022 }
00023
00024 BEGIN_MESSAGE_MAP(CVideoWindow, CWnd)
00025
00026 ON_WM_SIZE()
00027 ON_WM_CREATE()
00028 ON_MESSAGE (WM_VIDEONOTIFY, OnGraphMessage)
00029
00030 END_MESSAGE_MAP()
00031
00032 BOOL CVideoWindow::Create(CWnd *pWndParent)
00033 {
00034 CRect rc (2, 2, 150, 150);
00035
00036 LPCSTR pszClass = AfxRegisterWndClass (CS_HREDRAW|CS_VREDRAW, LoadCursor (NULL, IDC_ARROW), (HBRUSH) (GetStockObject (BLACK_BRUSH)), NULL);
00037
00038 if (FALSE == CWnd::CreateEx (WS_EX_CLIENTEDGE, pszClass, NULL,
00039 WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN, rc, pWndParent, 0))
00040 return FALSE;
00041
00042 return TRUE;
00043 }
00044
00045 void CVideoWindow::OnSize(UINT nType, int cx, int cy)
00046 {
00047 CWnd::OnSize(nType, cx, cy);
00048
00049 if (cx && cy)
00050 m_player.AutoSize ();
00051 }
00052
00053 int CVideoWindow::OnCreate(LPCREATESTRUCT lpCreateStruct)
00054 {
00055 if (CWnd::OnCreate(lpCreateStruct) == -1)
00056 return -1;
00057
00058 m_player.Initialize (m_hWnd);
00059
00060 return 0;
00061 }
00062
00063 LRESULT CVideoWindow::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
00064 {
00065 m_player.NotifyOwnerMessage (m_hWnd, message, wParam, lParam);
00066 return CWnd::WindowProc(message, wParam, lParam);
00067 }
00068
00069 LRESULT CVideoWindow::OnGraphMessage(WPARAM, LPARAM)
00070 {
00071 GetParent ()->SendMessage (WM_VIDEONOTIFY);
00072 return 0;
00073 }