主题:关于MFC所出现的问题
在基于MFC编写的播放器中,我用的是Windows Player Media组件,编译和链接都通过了,但是在运行的时候就出现了以下错误:
Debug Assertion Failed!
Program:E:\player\player\Debug\player.exe
File:afxcmn.inl
Line:142
之前都没出现这个问题,估计是在添加打开功能函数时出现了问题,代码如下
void CPlayerDlg::OnOpen()
{
// TODO: Add your control notification handler code here
CString strFilter = "AVI File (*.avi)|*.avi|";
strFilter += "MPEG File (*.mpg;*.mpeg)|*.mpg;*.mpeg|";
strFilter += "Mp3 File (*.mp3)|*.mp3|";
strFilter += "Wave File (*.wav)|*.wav|";
strFilter += "RMVB File (*.rmvb)|*.rmvb|";
strFilter += "All Files (*.*)|*.*|";
CFileDialog dlgOpen(TRUE, NULL, NULL, OFN_PATHMUSTEXIST | OFN_HIDEREADONLY,
strFilter, this);
if (IDOK == dlgOpen.DoModal())
{
mSourceFile = dlgOpen.GetPathName();
// Rebuild the file playback filter graph
CreateGraph();
GetDlgItem(IDC_FULL)->EnableWindow(TRUE);
//创建一个媒体
m_media = static_cast <CWMPMedia >(m_windows.newMedia(mSourceFile));
//将媒体添加到播放列表
m_playlist.appendItem(m_media);
//将列表添加到当前列表,以便实现自动播放
m_windows.SetCurrentPlaylist(m_playlist);
m_set = (CWMPSettings)m_windows.GetSettings();
//参数true设置自动播放,false不设置自动播放
m_set.SetAutoStart(true);
//将媒体的名字添加到列表控件
m_listCtrl.InsertItem(0, m_media.GetName());
}
}
希望各位大哥能帮小弟一个忙,感激不尽!
Debug Assertion Failed!
Program:E:\player\player\Debug\player.exe
File:afxcmn.inl
Line:142
之前都没出现这个问题,估计是在添加打开功能函数时出现了问题,代码如下
void CPlayerDlg::OnOpen()
{
// TODO: Add your control notification handler code here
CString strFilter = "AVI File (*.avi)|*.avi|";
strFilter += "MPEG File (*.mpg;*.mpeg)|*.mpg;*.mpeg|";
strFilter += "Mp3 File (*.mp3)|*.mp3|";
strFilter += "Wave File (*.wav)|*.wav|";
strFilter += "RMVB File (*.rmvb)|*.rmvb|";
strFilter += "All Files (*.*)|*.*|";
CFileDialog dlgOpen(TRUE, NULL, NULL, OFN_PATHMUSTEXIST | OFN_HIDEREADONLY,
strFilter, this);
if (IDOK == dlgOpen.DoModal())
{
mSourceFile = dlgOpen.GetPathName();
// Rebuild the file playback filter graph
CreateGraph();
GetDlgItem(IDC_FULL)->EnableWindow(TRUE);
//创建一个媒体
m_media = static_cast <CWMPMedia >(m_windows.newMedia(mSourceFile));
//将媒体添加到播放列表
m_playlist.appendItem(m_media);
//将列表添加到当前列表,以便实现自动播放
m_windows.SetCurrentPlaylist(m_playlist);
m_set = (CWMPSettings)m_windows.GetSettings();
//参数true设置自动播放,false不设置自动播放
m_set.SetAutoStart(true);
//将媒体的名字添加到列表控件
m_listCtrl.InsertItem(0, m_media.GetName());
}
}
希望各位大哥能帮小弟一个忙,感激不尽!