QT C++-如何在播放列表处于活动状态的情况下打开Windows Media Player
QT C++ - How to open Windows Media Player with a Playlist active?
我有一个项目,要求打开带有播放列表的windows媒体播放器。播放列表是根据选定的文件构建的。
从我发现的文档来看,打开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 PlaylistName
打开播放机并播放指定的播放列表。
使用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
相关文章:
- 为什么在Windows上的VS 2019和Clang 9中"size_t"在没有标题的情况下工作
- 在 Windows 上,是否可以让 dll 在不使用 PATH 环境变量的情况下在另一个文件夹中查找依赖项?
- (Windows 10) 在不更新的情况下重新启动C++
- 如何在不包含 Windows.h 的情况下获取 IsDebuggerPresent 的声明
- 在不使用API的情况下,如何在Windows中获取过程信息
- 可以在不在Windows中的ROS的情况下安装KDL_PARSER
- 如何在不使用 C/C++ (Windows) 中的 DOM 的情况下检查 XML 文件中的标记
- 如何在不使用UWP的情况下使用命名空间Windows.gaming.gaming.input
- 我可以在不安装Visual Studio [Windows]的情况下使用Intel C 编译器
- Windows:如何让子进程在不关闭输入匿名管道的情况下读取它
- 无法在支持Windows应用商店的情况下生成C++库
- 在不模拟Ctrl+V的情况下将数据粘贴到任何应用程序输入字段中.Windows c++
- 如何在不使用windows.h或Boost的情况下在Visual C++9.0中获得毫秒分辨率
- 在没有PDB文件的情况下,是否可以在Windows上获得堆栈跟踪?如果是,如何
- 如何在没有Windows API的情况下在Turbo-C++中制作一个简单的文本编辑器
- 这是存储 std::分配器状态的正确方法 - 在这种情况下,由 Windows 上的共享内存支持
- 如何在Windows操作系统的情况下将数据从OpenCV或C++线程函数返回到主线程
- 如何在不使用媒体转换管道的情况下在 Windows 应用程序中使用 MFT
- 如何在没有 Windows 分配驱动器号的情况下创建分区
- 如何在不擦除 Windows 上C++中的其他属性的情况下隐藏/取消隐藏文件