I have a project where the requirements are to open windows media player with a playlist. The playlist is built from selected files.
From the documentation 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 ?
#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<IWMPPlayer> spPlayer; // Smart pointer to IWMPPlayer interface.
hr = spPlayer.CoCreateInstance( __uuidof(WindowsMediaPlayer), 0, CLSCTX_INPROC_SERVER );
if(SUCCEEDED(hr))
{
hr = spPlayer->get_versionInfo(&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;
}
http://msdn.microsoft.com/en-us/library/windows/desktop/dd562624(v=vs.85).aspx
Halfway down the page it lists:
/Playlist PlaylistName
Open the Player and play the specified playlist.
Launch the program with QProcess
and specify the arguments.
http://qt-project.org/doc/qt-4.8/qprocess.html
Hope that helps.
EDIT: If you still want to use the WMP API, you could look into:
http://msdn.microsoft.com/en-us/library/windows/desktop/dd563405(v=vs.85).aspx
http://msdn.microsoft.com/en-us/library/windows/desktop/dd563242(v=vs.85).aspx
http://msdn.microsoft.com/en-us/library/windows/desktop/dd563547(v=vs.85).aspx