如何在没有Windows的情况下使用WMP引擎

发布于 2024-08-19 17:59:59 字数 146 浏览 3 评论 0原文

我正在编写一个简单的音频播放应用程序,为了节省编解码器费用,因此我们使用WMP ActiveX来播放所有音乐文件,但它需要为ActiveX创建一个窗口,并且创建ActiveX的线程应该有消息循环。我想知道有没有办法在没有ActiveX和Window的情况下使用WMP?提前致谢。

I'm writing a simple audio playback application, to save the codec fee, so we are using WMP ActiveX to play all music files, but it needs to create a window for ActiveX, and the thread of creating the ActiveX should have message loop. I would like to know if there is a way for WMP without ActiveX and Window? Thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

太阳男子 2024-08-26 17:59:59

是的,您不必使用 ActiveX 控件。只需使用“项目+添加引用”,“浏览”选项卡,选择 c:\windows\system32\wmp.dll

但您确实需要一个使用 [STAThread] 或 Thread.SetApartmentState() 初始化的线程和一个消息循环 (Application.Run) 。对于具有单线程单元要求的 COM 服务器(如 wmp.dll)来说是必需的。 COM 使用消息循环来编组调用并生成事件。如果没有循环,服务器就会死锁。

Yes, you don't have to use the ActiveX control. Just use Project + Add Reference, Browse tab, select c:\windows\system32\wmp.dll

But you really do need a thread that is initialized with [STAThread] or Thread.SetApartmentState() and a message loop (Application.Run). Is is required for COM servers (like wmp.dll) that have a Single Threaded Apartment requirement. COM uses the message loop to marshal calls and generate events. Without a loop, the server will deadlock.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文