qq_29460631 2015-07-10 12:54 采纳率: 50%
浏览 1847
已结题

VS2008制作多媒体播放器,WindowsMediaPlayer控件按钮出错

播放媒体后,按停止键(WindowsMediaPlayer),再将鼠标移至菜单栏(没有点击),立刻又继续播放
以下是部分代码:
BOOL CPLAYERDlg::OnInitDialog()
{
CDialog::OnInitDialog();
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
skinppLoadSkin(_T("blue.ssk"));//blue.ssk为项目下的皮肤文件,

// Add "About..." menu item to system menu.

// IDM_ABOUTBOX must be in the system command range.
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);
m_control=static_cast<CWMPControls>(m_play.GetControls());
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
    CString strAboutMenu;
    strAboutMenu.LoadString(IDS_ABOUTBOX);
    if (!strAboutMenu.IsEmpty())
    {
        pSysMenu->AppendMenu(MF_SEPARATOR);
        pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
    }
}

// Set the icon for this dialog.  The framework does this automatically
//  when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE);         // Set big icon
SetIcon(m_hIcon, FALSE);        // Set small icon

// TODO: Add extra initialization here

return TRUE;  // return TRUE  unless you set the focus to a control

}
void CPLAYERDlg::OnPlay()
{
// TODO: Add your control notification handler code here
CON=1;
CString str;
if(m_list.GetCount()<=0)MessageBox("请先打开最少一个媒体文件!","Warning",MB_OK);
else
{
KillTimer(1);
if(m_list.GetCurSel()<0)
{
m_list.SetCurSel(0);
}
index=m_list.GetCurSel();
m_list.GetText(index,str);
m_play.SetUrl(str);
SetTimer(1,1000,NULL);
}

}
void CPLAYERDlg::OnBnClickedSequence()
{
// TODO: 在此添加控件通知处理程序代码
FG=0;
}

void CPLAYERDlg::OnBnClickedRandom()
{
// TODO: 在此添加控件通知处理程序代码
FG=1;
}

void CPLAYERDlg::OnBnClickedCycle()
{
// TODO: 在此添加控件通知处理程序代码
FG=2;
}

void CPLAYERDlg::OnTimer(UINT_PTR nIDEvent)
{
// TODO: 在此添加消息处理程序代码和/或调用默认值
int index1=m_play.GetPlayState();
if(index1==1)
{
if(FG==0)
{
CString str;
int index=m_list.GetCurSel()+1;
if(index>=m_list.GetCount())
index=0;
m_list.GetText(index,str);
m_play.SetUrl(str);
m_list.SetCurSel(index);
}
else if(FG==1)
{
srand(time(0));
m_list.SetCurSel(rand()%m_list.GetCount());
m_list.GetText(m_list.GetCurSel(),m_pathname);
m_play.SetUrl(m_pathname);
}
else if(FG==2)
{
m_list.GetText(m_list.GetCurSel(),m_pathname);
m_play.SetUrl(m_pathname);
}
else;
}
CDialog::OnTimer(nIDEvent);
}

  • 写回答

3条回答 默认 最新

  • frank_20080215 2015-07-10 14:23
    关注

    添加菜单处理函数,禁止任何播放操作

    评论

报告相同问题?

悬赏问题

  • ¥15 【提问】基于Invest的水源涵养
  • ¥20 微信网友居然可以通过vx号找到我绑的手机号
  • ¥15 spring后端vue前端
  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
  • ¥15 解riccati方程组
  • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名
  • ¥65 汇编语言除法溢出问题