gpt4 book ai didi

c++ - QT C++ - 如何在播放列表处于事件状态时打开 Windows Media Player?

转载 作者:行者123 更新时间:2023-11-28 07:32:19 25 4
gpt4 key购买 nike

我有一个项目,要求打开带有播放列表的 Windows 媒体播放器。播放列表是从选定的文件构建的。

来自documentation我发现,打开 WMP 实例似乎很容易。但是我不确定如何构建播放列表或在 WMP 启动时将其插入。有什么想法吗?

#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

它列出的页面的一半:

/Playlist 播放列表名称

Open the Player and play the specified playlist.

使用 QProcess 启动程序并指定参数。

http://qt-project.org/doc/qt-4.8/qprocess.html

希望对您有所帮助。

编辑:如果您仍想使用 WMP API,您可以查看:

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

关于c++ - QT C++ - 如何在播放列表处于事件状态时打开 Windows Media Player?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17415408/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com