• 大小: 2.33MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-10-01
  • 语言: 其他
  • 标签: vc  播放器  

资源简介

实现音频的播放,并加有进度条,里面还带有基本步骤做法,很详细

资源截图

代码片段和文件信息

// MCIClass.cpp: implementation of the CMCIClass class.
//
//////////////////////////////////////////////////////////////////////

#include “stdafx.h“
#include 
#include 

//#include “MCIPlayer.h“
#include “MCIClass.h“

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CMCIClass::CMCIClass(HWND hWnd)
{
m_strMediumAlias = ““;
m_hWndCallback = hWnd;
m_bMediumOpen = FALSE;
}

CMCIClass::~CMCIClass()
{
Stop();
Close();
}

LONG CMCIClass::Open(LPCSTR strMediumName 
 LPCSTR strMediumType 
 LPCSTR strstyle 
 HWND hWnd)
{
if (IsMediumOpen())
{
Stop();
Close();
}

if (hWnd != NULL)
m_hWndCallback = hWnd;

CString strMedium = strMediumType;
CString strCmd = “open “;
 m_strMediumAlias = strMediumType;
m_strMediumAlias += “_ALIAS“;

strCmd += strMediumName;
strCmd += “ type “;
strCmd += strMediumType;
strCmd += “ alias “;
strCmd += m_strMediumAlias;

if (!strMedium.CompareNoCase(“AVIVideo“))
{
strCmd += “ style “;
strCmd += strstyle;

CString strHWnd;
if (m_hWndCallback != NULL)
{
strHWnd.Format(“ parent %u“ m_hWndCallback);
strCmd += strHWnd;
}
}

LONG lRet = Execute(strCmd);

if (lRet == 0)
m_bMediumOpen = TRUE;

return lRet;
}

LONG CMCIClass::Close()
{
m_bMediumOpen = FALSE;

CString strCmd = “close “;
strCmd += m_strMediumAlias;

return Execute(strCmd);
}

LONG CMCIClass::Play(LPCSTR strstyle LPCSTR strFlag)
{
CString strCmd = “play “;
strCmd += m_strMediumAlias;

CString strstyle0 = strstyle;
if (!strstyle0.CompareNoCase(“fullscreen“) ||
!strstyle0.CompareNoCase(“window“))
{
CString strPut = “put “;
strPut += m_strMediumAlias;
strPut += “ source destination“;
Execute(strPut);
strCmd += strstyle;
}

CString s = strFlag;
if (!s.IsEmpty())
{
strCmd += “ “;
strCmd += strFlag;
}

return Execute(strCmd);
}

LONG CMCIClass::Pause()
{
CString strCmd = “pause “;
strCmd += m_strMediumAlias;

return Execute(strCmd);
}

LONG CMCIClass::Resume()
{
CString strCmd = “resume “;
strCmd += m_strMediumAlias;

return Execute(strCmd);
}

LONG CMCIClass::Record()
{
CString strCmd = “record “;
strCmd += m_strMediumAlias;

return Execute(strCmd);
}

LONG CMCIClass::Save(LPCSTR strFileName)
{
CString strCmd = “save “;
strCmd += m_strMediumAlias + “ “;
strCmd += strFileName;

return Execute(strCmd);
}

LONG CMCIClass::Seek(LONG lPos)
{
CString strPos;
if (lPos == 0L)
strPos = “ to start“;
else if (lPos == -1L)
strPos = “ to end“;
else
strPos.Format(“ to %ld“ lPos);

CString strCmd = “seek “;
strCmd += m_strMediumAlias;
strCmd += strPos;

return Execu

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2014-06-01 15:40  MyPlayer\
     目录           0  2014-06-01 15:13  MyPlayer\Debug\
     文件       52450  2014-06-01 15:13  MyPlayer\Debug\MCIClass.obj
     文件      127029  2014-06-01 15:40  MyPlayer\Debug\MyPlayer.exe
     文件      258316  2014-06-01 15:40  MyPlayer\Debug\MyPlayer.ilk
     文件       15339  2013-04-16 19:48  MyPlayer\Debug\MyPlayer.obj
     文件     5504776  2013-04-16 19:48  MyPlayer\Debug\MyPlayer.pch
     文件      410624  2014-06-01 15:40  MyPlayer\Debug\MyPlayer.pdb
     文件        2928  2014-05-26 20:20  MyPlayer\Debug\MyPlayer.res
     文件       48135  2013-04-16 19:48  MyPlayer\Debug\MyPlayerDlg.obj
     文件      105993  2013-04-16 19:48  MyPlayer\Debug\StdAfx.obj
     文件      230400  2014-06-01 15:40  MyPlayer\Debug\vc60.idb
     文件      372736  2014-06-01 15:13  MyPlayer\Debug\vc60.pdb
     文件        6157  2002-12-10 22:49  MyPlayer\MCIClass.cpp
     文件        1386  2002-12-09 21:47  MyPlayer\MCIClass.h
     文件       36448  2014-05-26 20:20  MyPlayer\MyPlayer.aps
     文件        1502  2014-06-01 15:40  MyPlayer\MyPlayer.clw
     文件        2129  2002-12-14 23:37  MyPlayer\MyPlayer.cpp
     文件        4358  2003-05-16 23:12  MyPlayer\MyPlayer.dsp
     文件         539  2002-12-10 21:54  MyPlayer\MyPlayer.dsw
     文件        1346  2002-12-10 21:54  MyPlayer\MyPlayer.h
     文件      156672  2014-06-01 15:40  MyPlayer\MyPlayer.ncb
     文件      307712  2014-06-01 15:40  MyPlayer\MyPlayer.opt
     文件         726  2014-06-01 15:40  MyPlayer\MyPlayer.plg
     文件        6172  2014-05-26 20:20  MyPlayer\MyPlayer.rc
     文件        8356  2003-05-07 22:34  MyPlayer\MyPlayerDlg.cpp
     文件        1659  2003-05-07 20:52  MyPlayer\MyPlayerDlg.h
     文件        3615  2002-12-10 21:54  MyPlayer\ReadMe.txt
     文件         210  2002-12-10 21:54  MyPlayer\StdAfx.cpp
     文件        1054  2002-12-10 21:54  MyPlayer\StdAfx.h
     目录           0  2014-05-26 13:59  MyPlayer\res\
............此处省略3个文件信息

评论

共有 条评论