Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. A Strange Problem With WMP Control

A Strange Problem With WMP Control

Scheduled Pinned Locked Moved C / C++ / MFC
helpcsharpc++visual-studio
2 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    LieDragon
    wrote on last edited by
    #1

    Fisrt, I must say that my first language is not English, so my English is poor and maybe the article is hard to understand. But I will try my best to descript it. When I used the "CListCtrl" and "Windows Media Player Control" in MFC under Visual Studio 6.0, a strange problem occured.

    	CWMPPlayer4	m_wmpplayer;
    	m_wmpplayer.GetControls().stop();
    	m_wmpplayer.SetUrl("D:\\WestLife\\MyLove.mp3");
    	CWMPMedia media = m_wmpplayer.GetCurrentMedia();
    	for (int i = 0; i < 5; i++)
    	{
    		m_playlist.InsertItem(LVIF_TEXT | LVIF_STATE, i, media.getItemInfo("Name"), 0, LVIS_SELECTED, 0, 0);
    		
    		CString strBitRate = media.getItemInfo("BitRate");
    		int nBitRate = atoi(strBitRate.GetBuffer(strBitRate.GetLength()));
    		strBitRate.Format(_T("%dKbps"), nBitRate / 1000);
    		m_playlist.SetItemText(i, 1, media.getItemInfo("author"));
    		m_playlist.SetItemText(i, 2, strBitRate);
    		m_playlist.SetItemText(i, 3, m_wmpplayer.GetUrl());
    	}
    

    When I run the above code, the bitrate of the CListCtrl's list items' is 0kbps and the "author" is empty. But if I call the MessageBox function in the for-loop, the result is correct. The bitrate will be the fact bitrate and the author will also not be empty. I really cannot understand why this condition could happen. It would be a honor to me If you can help me solve this problem. Thank you very much.

    L 1 Reply Last reply
    0
    • L LieDragon

      Fisrt, I must say that my first language is not English, so my English is poor and maybe the article is hard to understand. But I will try my best to descript it. When I used the "CListCtrl" and "Windows Media Player Control" in MFC under Visual Studio 6.0, a strange problem occured.

      	CWMPPlayer4	m_wmpplayer;
      	m_wmpplayer.GetControls().stop();
      	m_wmpplayer.SetUrl("D:\\WestLife\\MyLove.mp3");
      	CWMPMedia media = m_wmpplayer.GetCurrentMedia();
      	for (int i = 0; i < 5; i++)
      	{
      		m_playlist.InsertItem(LVIF_TEXT | LVIF_STATE, i, media.getItemInfo("Name"), 0, LVIS_SELECTED, 0, 0);
      		
      		CString strBitRate = media.getItemInfo("BitRate");
      		int nBitRate = atoi(strBitRate.GetBuffer(strBitRate.GetLength()));
      		strBitRate.Format(_T("%dKbps"), nBitRate / 1000);
      		m_playlist.SetItemText(i, 1, media.getItemInfo("author"));
      		m_playlist.SetItemText(i, 2, strBitRate);
      		m_playlist.SetItemText(i, 3, m_wmpplayer.GetUrl());
      	}
      

      When I run the above code, the bitrate of the CListCtrl's list items' is 0kbps and the "author" is empty. But if I call the MessageBox function in the for-loop, the result is correct. The bitrate will be the fact bitrate and the author will also not be empty. I really cannot understand why this condition could happen. It would be a honor to me If you can help me solve this problem. Thank you very much.

      L Offline
      L Offline
      LieDragon
      wrote on last edited by
      #2

      Who can help me?

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups