在MFC视图窗口中打开Windows Media Player [英] Open Windows Media Player in MFC View Window

查看:112
本文介绍了在MFC视图窗口中打开Windows Media Player的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在视图窗口中打开一个Windows媒体播放器,我找到了以下MSDN文章:


http://msdn.microsoft.com/en -us / library / dd563023%28v = vs.85%29.aspx


我已经按照文章中的编码设置进行了操作,并且:

 void CTreeCtrl03View :: DisplayMov(CString movie)
{
CComPtr< IAxWinHostWindow> spHost;
HRESULT hr;
CRect Area,TempBox,rcClient;
CClientDC pDC(this);
GetClientRect(& rcClient);
m_wndView.Create(m_hWnd,rcClient,NULL,WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN,WS_EX_CLIENTEDGE);
hr = m_wndView.QueryHost(& spHost);
hr = spHost-> CreateControl(CComBSTR(_T(" {6BF52A52-394A-11d3-B153-00C04F79FAA6}")),m_wndView,0);
hr = m_wndView.QueryControl(& m_spWMPPlayer);
...
...
...

当我到达QueryHost行时,hr返回E_FAIL,当然从那里开始全部下坡。我找不到任何其他的例子虽然SDK中有一个引用,但我也找不到。帮助将不胜感激。

解决方案


您使用的是哪个版本的visual studio?您是否使用ATL支持创建项目?您可以查看下面的类似主题以供参考。


ATL CAxWindow :: QueryHost返回E_FAIL


据我所知,有几种不同的方法可以在C ++程序中使用Windows Media Player控件。您可以在控制台应用程序中创建控件的实例,也可以将控件嵌入到Windows应用程序中。此外,您可以实现
接口,使您能够以远程模式运行嵌入式播放器控件。您可以通过应用外观定义文件来自定义嵌入式控件的用户界面。有关不同方式的更多信息,请参阅此链接:


http://msdn.microsoft.com/en-us/library/dd564580(v = vs.85).aspx


关于示例, Windows Media Player SDK包含各种演示许多编程技术的示例。



  • 脚本示例演示了如何在网页中嵌入Player ActiveX控件。完整的网页示例演示了如何检测当前版本的Player ActiveX控件。
  • 皮肤示例演示了如何更改Windows Media Player的视觉外观和行为。
  • A Microsoft Visual C ++向导可以创建几种插件的独特工作示例:可视化插件,用户界面插件,渲染插件和数字信号处理插件。
  • 用于在线商店的示例包括一个Microsoft Visual C ++向导,可以创建在线商店COM对象的唯一工作示例。
  • Microsoft Visual C ++示例演示了嵌入Windows Media Player ActiveX控件,远程处理Player ActiveX控件,并使用库。
  • AC#sample演示如何使用带有.NET Framework的Windows Media Player ActiveX控件。
  • Visual Basic .NET示例演示将Windows Media Player ActiveX控件与.NET Framework一起使用。

T. o使用示例,您必须安装Windows SDK,其中包括Windows Media Player SDK。要下载Windows SDK,请转到Windows开发人员中心的
Windows SDK 页面。


希望这对你有所帮助。


可能


I want to open a windows media player in a view window, and I have found the following MSDN article:

http://msdn.microsoft.com/en-us/library/dd563023%28v=vs.85%29.aspx

I have followed the coding setup in the article and have:

void CTreeCtrl03View::DisplayMov(CString movie)
{
CComPtr<IAxWinHostWindow>  spHost;
HRESULT  hr;
CRect Area, TempBox, rcClient;
CClientDC pDC(this);
GetClientRect(&rcClient);
m_wndView.Create(m_hWnd, rcClient, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN, WS_EX_CLIENTEDGE);
hr = m_wndView.QueryHost(&spHost);
hr = spHost->CreateControl(CComBSTR(_T("{6BF52A52-394A-11d3-B153-00C04F79FAA6}")), m_wndView, 0);
hr = m_wndView.QueryControl(&m_spWMPPlayer);
...
...
...

When I get to the QueryHost line, hr returns E_FAIL, and of course its all downhill from there. I can't find any other examples though there are references to one in the SDK but I can't find that either. Help would be appreciated.

解决方案

Hi,

Which version of visual studio did you use? Did you create the project with ATL support? You can take a look at the similar thread below for reference.

ATL CAxWindow::QueryHost returns E_FAIL

As far as I know, there are several different ways to use the Windows Media Player control in a C++ program. You can create an instance of the control in a console application, or you can embed the control in a Windows application. Also, you can implement interfaces that enable you to run an embedded Player control in remote mode. You can customize the user interface of an embedded control by applying a skin definition file. More about different ways, please refer to this link:

http://msdn.microsoft.com/en-us/library/dd564580(v=vs.85).aspx

About the examples, the Windows Media Player SDK includes a variety of samples that demonstrate many of the programming techniques.

  • Scripting samples demonstrate how to embed the Player ActiveX control in a webpage. A complete webpage sample demonstrates how to detect the current version of the Player ActiveX control.
  • A skins sample demonstrates how to change the visual appearance and the behavior of Windows Media Player.
  • A wizard for Microsoft Visual C++ can create a unique working sample of several types of plug-in: a visualization plug-in, a user interface plug-in, a rendering plug-in, and a digital signal processing plug-in.
  • Samples for online stores include a wizard for Microsoft Visual C++ that can create a unique working sample of an online store COM object.
  • Samples for Microsoft Visual C++ demonstrate embedding the Windows Media Player ActiveX control, remoting the Player ActiveX control, and working with the library.
  • A C# sample demonstrates using the Windows Media Player ActiveX control with the .NET Framework.
  • A Visual Basic .NET sample demonstrates using the Windows Media Player ActiveX control with the .NET Framework.

To use the samples, you must install the Windows SDK, which includes the Windows Media Player SDK. To download the Windows SDK, go to the Windows SDK page in the Windows Developer Center.

Hope this is helpful for you.

May


这篇关于在MFC视图窗口中打开Windows Media Player的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆