Windows媒体播放器 [英] Windows Media Player

查看:112
本文介绍了Windows媒体播放器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

今天我正在阅读在线文章,而且,我想知道你是否会有一些调用Windows Media Player作为对象的样本,因为当我尝试在COM组件下添加引用时,我找不到名为IWMPPlaylist的COM对象。



也有人能提醒我COM对象的缺点以及为什么我应该避免它们吗?



不可否认我确实在网上找到了 [ ^ ]但是,我并不完全确定我得到了提供有效媒体播放器所需的所有说明。



这可以作为WMP w = new WMP轻松使用的对象(),然后r在MSDN上查看文档?

解决方案

我所知道的COM对象对内存有很大的要求..


进程内服务器通过本地服务器的编辑功能提供对象处理程序的速度和大小优势。那么为什么你会选择将OLE应用程序实现为本地服务器而不是进程内服务器?有几个原因:

安全性。只有本地服务器的地址空间与客户端的地址空间隔离。进程内服务器共享客户端的地址空间和进程上下文,因此在面对错误或恶意编程时可能不那么健壮。

粒度。本地服务器可以跨多个不同的客户端托管其对象的多个实例,在多个客户端中的对象之间共享服务器状态,如果实现为进程内服务器(这只是加载到每个客户端的DLL)将是困难或不可能的。

兼容性。如果选择实现进程内服务器,则放弃与不支持此类服务器的OLE 1的兼容性。对于许多开发人员来说,这不是一个考虑因素,但如果是这样,那么这是一个至关重要的问题。

无法支持链接。进程内服务器不能用作链接源。由于DLL无法自行运行,因此无法创建要链接的文件对象。





要使用Media Player播放简单的播放列表,您需要喜欢使用:

 Process.Start(  wmplayer .exe 播放列表路径); 

< br $> b $ b或

MSDN:在C#解决方案中嵌入Windows Media Player控件 [ ^ ]



- 艾米

Today I was reading an online article, and, I was wondering whether you would have some samples of calling Windows Media Player as an object, as I cannot quite find a COM object named IWMPPlaylist, when I try to add a reference under COM components.

Also can anyone remind me of the disadvantages of COM Objects and why I should avoid them?

Admittedly I did find an online article at ,[^], however, I am not quite sure I am getting all the instructions required to come up with a working Media Player.

Is this available as an object that I can easily use as WMP w = new WMP(), and, then review the documentation on MSDN?

解决方案

What I know COM objects have huge requirements on memory..


In-process servers provide the speed and size advantage of an object handler with the editing capability of a local server. So why would you ever choose to implement your OLE application as a local server rather than an in-process server? There are several reasons:
Security. Only a local server has its address space isolated from that of the client. An in-process server shares the address space and process context of the client and can therefore be less robust in the face of faults or malicious programming.
Granularity. A local server can host multiple instances of its object across many different clients, sharing server state between objects in multiple clients in ways that would be difficult or impossible if implemented as an in-process server, which is simply a DLL loaded into each client.
Compatibility. If you choose to implement an in-process server, you relinquish compatibility with OLE 1, which does not support such servers. This will not be a consideration for many developers, but if it is, then it is of critical concern.
Inability to support links. An in-process server cannot serve as a link source. Since a DLL cannot run by itself, it cannot create a file object to be linked to.



To play a simple playlist using Media Player, you would like to use:

Process.Start("wmplayer.exe", "Playlist Path");


Or
MSDN : Embedding the Windows Media Player Control in a C# Solution[^]

--Amy


这篇关于Windows媒体播放器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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