关于定时器的问题,请高手指点。编译后提示说:unknown character 'oxa1'
代码如下:
void CPlayerDlg::OnPlay()
{
int nCount=playlist.GetSize();
while(nCount>0)
{
playlist.RemoveAt(nCount);
nCount--;
}
int lIndex=m_combouser.GetCurSel();
if(lIndex==CB_ERR)
{
::AfxMessageBox("请选择用户!");
return;
}
else
{
CString lfoundstr;
m_combouser.GetLBText(lIndex,lfoundstr);
CString PathName1,PathName2;
// int i;
//pathname="d:\\"+lfoundstr+"\\"+lfoundstr;
PathName1="d:\\"+lfoundstr+"\\"+lfoundstr+"1.avi";
PathName2="d:\\"+lfoundstr+"\\"+lfoundstr+"2.avi";
playlist.Add(PathName1);
playlist.Add(PathName2);
SetTimer(0,500,NULL);
}
}
void CPlayerDlg::OnTimer(UINT nIDEvent)
{ //int i=1;
CString m_filename;//定义文件变量
number=playlist.GetSize();
double CurPos=m_ActiveMovie.GetCurrentPosition();
//获得播放位置
if(CurPos==0)
{
m_filename=playlist[1];
m_ActiveMovie.SetAutoStart(1); //设置自动播放
m_ActiveMovie.SetFileName(m_filename);//设置文件
m_ActiveMovie.Run();//播放
playlist.RemoveAt(1);
number--;}
CDialog::OnTimer(nIDEvent); if(number==0)
{
KillTimer(0);
m_ActiveMovie.Stop();
}
}
代码如下:
void CPlayerDlg::OnPlay()
{
int nCount=playlist.GetSize();
while(nCount>0)
{
playlist.RemoveAt(nCount);
nCount--;
}
int lIndex=m_combouser.GetCurSel();
if(lIndex==CB_ERR)
{
::AfxMessageBox("请选择用户!");
return;
}
else
{
CString lfoundstr;
m_combouser.GetLBText(lIndex,lfoundstr);
CString PathName1,PathName2;
// int i;
//pathname="d:\\"+lfoundstr+"\\"+lfoundstr;
PathName1="d:\\"+lfoundstr+"\\"+lfoundstr+"1.avi";
PathName2="d:\\"+lfoundstr+"\\"+lfoundstr+"2.avi";
playlist.Add(PathName1);
playlist.Add(PathName2);
SetTimer(0,500,NULL);
}
}
void CPlayerDlg::OnTimer(UINT nIDEvent)
{ //int i=1;
CString m_filename;//定义文件变量
number=playlist.GetSize();
double CurPos=m_ActiveMovie.GetCurrentPosition();
//获得播放位置
if(CurPos==0)
{
m_filename=playlist[1];
m_ActiveMovie.SetAutoStart(1); //设置自动播放
m_ActiveMovie.SetFileName(m_filename);//设置文件
m_ActiveMovie.Run();//播放
playlist.RemoveAt(1);
number--;}
CDialog::OnTimer(nIDEvent); if(number==0)
{
KillTimer(0);
m_ActiveMovie.Stop();
}
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货