zoukankan      html  css  js  c++  java
  • C#中使用windows medie player控件

     windows medie player (以下简称WMP),默认不在vs2005的toolbox中,因此,需要手动添加,下面是在vs2005中使用WMP控件的步骤:

    The following is the walkthrough to use a Windows Media Player COM
    component in a WinForms application.

    1. If the Windows Media Player COM component is not present in the Toolbox,
    right-clikc on the Toolbox and choose 'Choose Items'. In the 'Choose
    Toolbox Items' dialog, switch to the 'COM Components' tab. Navigate to
    'Windows Media Player' (whose path is 'c:\Windows\system32\wmp.dll') and
    select the checkbox before this item. Press OK.

    2. Drag&drop the Window Media Player COM component from Toolbox onto a
    form. At this time, VS IDE will generate wrapper classes for this COM
    component automatically. COM components are not managed, so we couldn't use
    them directly in .NET applications.

    If you expand the Reference node under the project node in the Solution
    Explorer, you should see two references called 'AxWMPLib' and 'WMPLib' are
    added.

    3. You may add the following code to the form:

    private void Form1_Load(object sender, EventArgs e)
    {
        // the 'axWindowsMediaPlayer1' is the name of the Windows Media Player
    COM component on the form
        MessageBox.Show(this.axWindowsMediaPlayer1.versionInfo);
        this.axWindowsMediaPlayer1.URL = "the path of the video/audio file";
    }

    4. Build the project. Go to the bin\debug folder of the application and you
    should see two files called 'AxInterop.WMPLib.dll' and
    'Interop.WMPLib.dll', which are the dll files that contain the wrapper
    classes for the Windows Media Player COM component.

  • 相关阅读:
    Oracle SQL部分练习题
    Oracle 数据库和监听器开机自启动两种实现方法
    用Python连接SQLServer抓取分析数据、监控 (pymssql)
    Linux6.5 安装Python3.X(转载)
    SQLServer xp_instance_regread returned error 5,Access is denied(配置最小权限)
    [MySQL]存储过程
    [MySQL]触发器
    Linux 修改IP地址
    MySQL: InnoDB存储引擎
    mysql 重新添加主节点 (GTID)
  • 原文地址:https://www.cnblogs.com/findcaiyzh/p/1979556.html
Copyright © 2011-2022 走看看