【问题标题】:How to use WMPLib in C#如何在 C# 中使用 WMPLib
【发布时间】:2018-12-28 19:46:52
【问题描述】:

我正在尝试导入 WMPLib 但 Visual Studio 但它正在发出消息 Type or Namespace name 'WMPLib' could not be found。 我也尝试过使用 System.Windows.Media 但对于 Media 它再次给出相同的消息。 我尝试从

添加工具箱 Windows Media Player
Choose Tool Box Items->Com Components->Windows Media Player

但这不起作用。

【问题讨论】:

    标签: c# wmplib


    【解决方案1】:

    要以编程方式创建 Windows Media Player 控件,您必须首先添加对 wmp.dll 的引用,该文件位于 \Windows\system32 文件夹中。添加此引用会在您的项目文件夹中创建 WMPLib.dll,并且对 WMPLib 的引用会出现在解决方案资源管理器中。

    以下链接会对您有所帮助。

    Creating the Windows Media Player Control Programmatically

    【讨论】:

    • 我试过了,但它不起作用。还是同样的消息。
    • 您能否发布完整的错误消息,因为上述解决方案对我们有用。
    • 我正在 Visual Studio 2012 中开发我的项目。当我使用代码 using WMPLib; 时,它显示以下错误 Error 1 The type or namespace name 'WMPLib' could not be found (are you missing a using directive or an assembly reference?) E:\c#.net\new_project\FirstWinService\FirstWinService\SchedulerService.cs 10 7 FirstWinService
    • 您还需要在文件顶部添加using WMPLib;
    猜你喜欢
    • 1970-01-01
    • 2023-03-26
    • 2011-10-02
    • 1970-01-01
    • 2016-01-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多