home *** CD-ROM | disk | FTP | other *** search
- // PlayerView.cpp : implementation file
- //
-
- #include "stdafx.h"
- #include "SCPlayer.h"
- #include "PlayerView.h"
- #include "atlconv.h"
-
- #pragma comment(lib, "strmiids.lib")
-
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
-
- /////////////////////////////////////////////////////////////////////////////
- // CPlayerView
-
- /////////////////////////////////////////////////////////////////////////
-
- CPlayerView::CPlayerView()
- {
- }
-
- CPlayerView::~CPlayerView()
- {
- // MCIWndDestroy(m_hPlayerWnd);
- }
-
-
- BEGIN_MESSAGE_MAP(CPlayerView, CStatic)
- //{{AFX_MSG_MAP(CPlayerView)
- ON_WM_PAINT()
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
-
- /////////////////////////////////////////////////////////////////////////////
- // CPlayerView message handlers
-
- LRESULT CPlayerView::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
- {
- /* switch(message) {
- case WM_PAINT:
- break;
- case :
- break;
- default:
- }*/
-
- return CStatic::WindowProc(message, wParam, lParam);
- }
-
- void CPlayerView::InitMCI()
- {
- // m_hPlayerWnd = MCIWndCreate(this->m_hWnd,AfxGetInstanceHandle(),
- //WS_CHILD | WS_VISIBLE| MCIWNDF_NOMENU| MCIWNDF_NOTIFYALL| MCIWNDF_NOPLAYBAR,
- ///*filename*/NULL);
- //MCIWndSetTimeFormat(m_hPlayerWnd,"ms");
- // MCIWndSetActiveTimer(m_hPlayerWnd,100);
- //m_nVolume = MCIWndGetVolume(m_hPlayerWnd);
- }
-
- void CPlayerView::OnPaint()
- {
- CPaintDC dc(this); // device context for painting
-
- }
-
- BOOL CPlayerView::PreCreateWindow(CREATESTRUCT& cs)
- {
- // TODO: Add your specialized code here and/or call the base class
-
- // return FALSE;
- return CStatic::PreCreateWindow(cs);
- }
-
- int CPlayerView::OpenFile(CString filename)
- {
- // int ret = MCIWndOpen(m_hPlayerWnd,filename.GetBuffer(filename.GetLength()),0);
- // filename.ReleaseBuffer();
- return 1;//ret;
- }
-
- int CPlayerView::PlayFile()
- {
- //return MCIWndPlay(m_hPlayerWnd);
- /* IGraphBuilder *pGraph;
- IMediaControl *pMediaControl;
- IMediaEvent *pEvent;
- CoInitialize(NULL);
-
- // Create the filter graph manager and query for interfaces.
- CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER,
- IID_IGraphBuilder, (void **)&pGraph);
- pGraph->QueryInterface(IID_IMediaControl, (void **)&pMediaControl);
- pGraph->QueryInterface(IID_IMediaEvent, (void **)&pEvent);
-
-
- CFileDialog dlg(TRUE);
- if(dlg.DoModal() == IDOK)
- {
- CString str = dlg.GetPathName();
-
- LPWSTR wstr;// = ProduceWFromA(CP_ACP,str);
- // Build the graph. IMPORTANT: Change string to a file on your system.
-
- pGraph->RenderFile(wstr, NULL);
-
- ::LocalFree(wstr);
- // Run the graph.
- pMediaControl->Run();
-
- // Wait for completion.
- long evCode;
- pEvent->WaitForCompletion(INFINITE, &evCode);
- }
-
- // Clean up.
- pMediaControl->Release();
- pEvent->Release();
- pGraph->Release();
- CoUninitialize();*/
- return 1;
- }
-
-