|
// Player.cpp: implementation of the CPlayer class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "Player.h"
#include "vfw.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CPlayer::CPlayer(HWND hwParent)
{
hwndParent=hwParent;
m_sPath="";
c_Player=NULL;
}
CPlayer::CPlayer()
{
hwndParent=NULL;
m_sPath="";
c_Player=NULL;
}
CPlayer::~CPlayer()
{
MCIWndDestroy(c_Player);
c_Player=NULL;
m_sPath="";
}
void CPlayer::SetPath(CString sPath)
{
m_sPath.Format("%s",sPath);
}
CString CPlayer::GetPath()
{
return m_sPath;
}
void CPlayer::Play()
{
c_Player=MCIWndCreate(hwndParent,AfxGetInstanceHandle(),
WS_CHILD | WS_VISIBLE| MCIWNDF_NOMENU,
m_sPath);
MCIWndPlay(c_Player);
}
void CPlayer::Stop()
{
MCIWndStop(c_Player);
MCIWndDestroy(c_Player);
}
void CPlayer::Pause()
{
MCIWndPause(c_Player);
}
void CPlayer::Resume()
{
MCIWndResume(c_Player);
}
CString CPlayer::GetMode()
{
char* lp=new char[3];
CString x;
MCIWndGetMode(c_Player,lp,sizeof(lp));
x=(char*) lp;
delete [] lp;
return x;
}
void CPlayer::Loop()
{
CString x;
c_Player=MCIWndCreate(hwndParent,AfxGetInstanceHandle(),
WS_CHILD | WS_VISIBLE|MCIWNDF_NOMENU,
m_sPath);
MCIWndPlay(c_Player);
while()
{
x=GetMode();
if (x!="pla")
{
MCIWndDestroy(c_Player);
}
}
}
void CPlayer::Break()
{
}
void CPlayer::SetParent(HWND hParent)
{
hwndParent=hParent;
}
HWND CPlayer::GetParent()
{
return hwndParent;
}
void CPlayer::SetPath(CString sPath)
{
m_sPath.Format("%s",sPath);
}
CString CPlayer::GetPath()
{
return m_sPath;
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.