本文介紹如何插入RealPlay控件實現媒體文件的播放,代碼運行效果圖如下:
下面簡要介紹一下具體實現步驟:
(工程->添加工程->compontent and controls->registed ActiveX controls )。
void CSunapplerealplayerDlg::OnOpen()
{
char szFileFilter[]=
"RM File(*.rm)|*.rm|"
"Mp3 File(*.mp3)|*.mp3|"
"MPEG File(*.mpeg)|*.mpeg|"
"Media File(*.asf)|*.asf|"
"Video File(*.dat)|*.dat|"
"MPGA File(*.mpga)|*.mpga|"
"Wave File(*.wav)|*.wav|"
"AVI File(*.avi)|*.avi|"
"Movie File(*.mov)|*.mov|"
"Mid File(*.mid;*,rmi)|*.mid;*.rmi|"
"Wma File(*.wma)|*.wma|"
"All File(*.*)|*.*||";
CFileDialog dlg(TRUE,NULL,NULL,OFN_HIDEREADONLY,szFileFilter);
if(dlg.DoModal()==IDOK){
CString PathName=dlg.GetPathName();
PathName.MakeUpper();
m_player->SetSource(PathName);
m_player->DoPlay();
SetDlgItemText(ID