title: MP3 playing using mci send string c++
body: <p>I'm trying to play some mp3 files as my background music in one of my project which Im doing. I tried to play it using mcisendstring but it just couldnt work :(</p>
  
  <p>These what I have done:</p>
  
  <pre><code>CMP3_MCI myMp3;
  std::string address= "C:\\Users\\music embed testing\\test.mp3";
  myMp3.Load(address);
  myMp3.Play();
  </code></pre>
  
  <p>//Load function</p>
  
  <pre><code>void Load(string szFileName)
  {
      m_szFileName = szFileName;
      Load2();
  }
  </code></pre>
  
  <p>//load2 function</p>
  
  <pre><code>void Load2()
  {
        std::string szCommand = "open \"" + GetFileName() + "\" type mpegvideo alias " + GetFileName();       
         mciSendString(szCommand.c_str(), NULL, 0, 0);
  }
  </code></pre>
  
  <p>//play function</p>
  
  <pre><code>void Play()
  {
      std::string szCommand = "play " + GetFileName() + " from 0";
      mciSendString(szCommand.c_str(), NULL, 0, 0);
  }
  </code></pre>
  
  <p>//getFileName basically returns m_szFileName stored as private attribute</p>