播放mp3的,添翼虎前辈写的虽然是播放mp3但是我通篇没有找到播放mp3的函数,以下是暂停,上,下一首,停止的源码:
void CTigerPlayDlg::OnPause()
{
// TODO: Add your command handler code here
}void CTigerPlayDlg::OnPrev()
{
// TODO: Add your command handler code here
nCurrentMusic -- ;
if(nCurrentMusic < 0 )
nCurrentMusic = nMusicCount ;
OnPlay();
}void CTigerPlayDlg::OnNext()
{
// TODO: Add your command handler code here
nCurrentMusic ++ ;
if(nCurrentMusic >= nMusicCount )
nCurrentMusic = 0 ;
OnPlay();
}
这个是play的源码:
void CTigerPlayDlg::OnPlay()
{
// TODO: Add your command handler code here
CRect cDispRect ;
cDispRect.SetRect(coordinatesMain[AREA_DISPLAYBAR].x,
coordinatesMain[AREA_DISPLAYBAR].y,
coordinatesMain[AREA_DISPLAYBAR].x+coordinatesMain[AREA_DISPLAYBAR].iWidth ,
coordinatesMain[AREA_DISPLAYBAR].y+coordinatesMain[AREA_DISPLAYBAR].iHeight
); m_szMp3File = GetMusicFile("PlayList.ini",nCurrentMusic);
RedrawWindow(cDispRect);
}
////////////////////////////////////////
另我疑惑的是根本没有什么函数或者控件表明了播放mp3这个东西???作者做了一个bmp,把它覆盖?(不知表达得对不对)作为了程序的主界面。在debug下面没有办法播放mp3,但是作者提供的安装程序安装后可以播放。
void CTigerPlayDlg::OnPause()
{
// TODO: Add your command handler code here
}void CTigerPlayDlg::OnPrev()
{
// TODO: Add your command handler code here
nCurrentMusic -- ;
if(nCurrentMusic < 0 )
nCurrentMusic = nMusicCount ;
OnPlay();
}void CTigerPlayDlg::OnNext()
{
// TODO: Add your command handler code here
nCurrentMusic ++ ;
if(nCurrentMusic >= nMusicCount )
nCurrentMusic = 0 ;
OnPlay();
}
这个是play的源码:
void CTigerPlayDlg::OnPlay()
{
// TODO: Add your command handler code here
CRect cDispRect ;
cDispRect.SetRect(coordinatesMain[AREA_DISPLAYBAR].x,
coordinatesMain[AREA_DISPLAYBAR].y,
coordinatesMain[AREA_DISPLAYBAR].x+coordinatesMain[AREA_DISPLAYBAR].iWidth ,
coordinatesMain[AREA_DISPLAYBAR].y+coordinatesMain[AREA_DISPLAYBAR].iHeight
); m_szMp3File = GetMusicFile("PlayList.ini",nCurrentMusic);
RedrawWindow(cDispRect);
}
////////////////////////////////////////
另我疑惑的是根本没有什么函数或者控件表明了播放mp3这个东西???作者做了一个bmp,把它覆盖?(不知表达得对不对)作为了程序的主界面。在debug下面没有办法播放mp3,但是作者提供的安装程序安装后可以播放。
解决方案 »
- VS中装上“Visual Assist X”
- CString如何格式化字符串?
- iocp udp 不能 WSARecvFrom 吗?10045不支持?
- 为什么我的程序nod32总说是木马变种
- Edit control的奇怪问题——
- char* 与string互转的问题。
- VC++编译出错
- 我的一个按钮被我所画的圆覆盖了,我现在想让我的按钮覆盖我所画的那个圆。我该怎么办??
- 调用dll出错
- 请问这句话什么意思:You must select Report view not Icon view in the resource editor?
- 求助一个理想的显示饼图形的3D控件
- 函数指针声明后 如何执行??
[email protected]
如果是根据mp3文件格式自己解码播放则另当别论。
如果是调用系统现成的,应该是调用mciSendString。
楼主可以仔细看看GetMusicFile函数,一步一步找,看看最终是不是调用mciSendString。
可以看看debug版的project setting下的link有没有winmm.lib,如果debug下没有而release下有,则调用mciSendString的可能性就99%了。//在debug下面没有办法播放mp3,但是作者提供的安装程序安装后可以播放。
也可能是用了控件,安装程序在安装时注册了控件,这种可能性不是特别大。
那么安装注册控件,就凭上面的代码如何响应播放动作啊???到这里下载就可以了,恕不发至各位邮箱了,可以多点人知道:
http://218.108.41.12/vchome/book/allbook.asp
release版编译后是 228kb
而安装后的TigerPlay.exe是 420kb
可见作者并没有完全公开源代码,而且隐藏了相当一部分代码,尤其是播放部分。
程序的IAT中也没有winmm.dll,所以肯定不是调用mciSendString函数,更没有用windows的多媒体函数。作者很有可能是自己解码播放mp3,楼主可以直接找作者问问。 :D