title: QT C++ - How to open Windows Media Player with a Playlist active?
body: <p>I have a project where the requirements are to open windows media player with a playlist. The playlist is built from selected files. </p>
  
  <p>From the <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/dd564579%28v=vs.85%29.aspx" rel="nofollow">documentation</a> I found, it appears easy to open a WMP instance.  However I'm not sure how to build the playlist or insert it on WMP startup. Any Thoughts ?</p>
  
  <pre><code>#include "atlbase.h"
  #include "atlwin.h"
  #include "wmp.h"
  
  int _tmain(int argc, _TCHAR* argv[])
  {
      CoInitialize(NULL);
  
      HRESULT hr = S_OK;
      CComBSTR bstrVersionInfo; // Contains the version string.
      CComPtr&lt;IWMPPlayer&gt; spPlayer;  // Smart pointer to IWMPPlayer interface.
  
      hr = spPlayer.CoCreateInstance( __uuidof(WindowsMediaPlayer), 0, CLSCTX_INPROC_SERVER );
  
      if(SUCCEEDED(hr))
      {
          hr = spPlayer-&gt;get_versionInfo(&amp;bstrVersionInfo);
      }
  
      if(SUCCEEDED(hr))
      {
          // Show the version in a message box.
          COLE2T pStr(bstrVersionInfo);
          MessageBox( NULL, (LPCSTR)pStr, _T("Windows Media Player Version"), MB_OK );
      }
  
      // Clean up.
      spPlayer.Release();
      CoUninitialize();
  
      return 0;
  }
  </code></pre>