1.Windows Media Player常用设置属性
- CWMPPlayer4 m_player;
- m_player.PlayCount
- m_player.AutoRewind
- m_player.EnableContextMenu
- m_player.AnimationAtStart
- m_player.ShowControls
- m_player.ShowAudioControls
- m_player.ShowDisplay
- m_player.ShowGotoBar
- m_player.ShowPositionControls
- m_player.ShowStatusBar
- m_player.ShowTracker
2.关联到具体对象
- CWMPControls m_control;
- CWMPSettings m_set;
- CWMPPlaylist m_playlist;
- CWMPMedia m_media;
- m_control = static_cast<CWMPControls>(m_player.get_controls());
- m_media = static_cast<CWMPMedia>(m_player.newMedia(fileName));
- m_playlist = m_player.get_currentPlaylist;
- m_set = (CWMPSettings)m_wmplayer.get_settings();
- m_set.put_autoStart(true);
3.播放列表和listbox关联
- 为了确定当前播放的曲目在listbox的位置,需用到以下方式
- void CPlayDlg::CurrentItemChangeOcx1(LPDISPATCH pdispMedia)
- {
-
- m_media = static_cast<CWMPMedia>(pdispMedia);
- int count=m_playlist.get_count();
- for (int i=0;i<count;i++)
- {
- if (m_media.get_isIdentical(m_playlist.get_Item(i)))
- {
- m_listbox.SetCurSel(i);
- }
- }
- }
4.扩展根据需要重载,单击左键实现暂停和播放的切换
- void CPlayDlg::ClickOcx1(short nButton, short nShiftState, long fX, long fY)
- {
-
- if (nButton==1)
- {
- if (m_wmplayer.get_playState()==2)
- {
- m_control.play();
- }
- else
- {
- m_control.pause();
- }
- }
- }
版权声明:本文为博主原创文章,未经博主允许不得转载。