[英]QT C++ - How to open Windows Media Player with a Playlist active?
I have a project where the requirements are to open windows media player with a playlist. 我有一个项目,要求打开带有播放列表的Windows Media Player。 The playlist is built from selected files.
播放列表是根据所选文件构建的。
From the documentation I found, it appears easy to open a WMP instance. 从我发现的文档中 ,打开WMP实例似乎很容易。 However I'm not sure how to build the playlist or insert it on WMP startup.
但是我不确定如何建立播放列表或在WMP启动时将其插入。 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 http://msdn.microsoft.com/zh-CN/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. 使用
QProcess
启动程序并指定参数。
http://qt-project.org/doc/qt-4.8/qprocess.html 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: 编辑:如果您仍然想使用WMP API,则可以进行以下研究:
http://msdn.microsoft.com/en-us/library/windows/desktop/dd563405(v=vs.85).aspx http://msdn.microsoft.com/zh-CN/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/zh-CN/library/windows/desktop/dd563242(v=vs.85).aspx
http://msdn.microsoft.com/en-us/library/windows/desktop/dd563547(v=vs.85).aspx http://msdn.microsoft.com/zh-CN/library/windows/desktop/dd563547(v=vs.85).aspx
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.