Question

i have used the Windows media player in visual studio 2010 but it can not run and give the following error. How can i solve these error i also change my build setting from X86 to AnyCPU but till it don't work. The error is following "Could not load file or assembly 'Interop.WMPLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.":"Interop.WMPLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"

<Window x:Class="MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:wf="clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms" 
    xmlns:ax="clr-namespace:AxWMPLib;assembly=AxInterop.WMPLib"
    Title="MainWindow" Height="350" Width="525">
    <Grid>
        <WindowsFormsHost Name="winfromhost" HorizontalAlignment="Left" Height="300" Margin="10,10,0,0" VerticalAlignment="Top" Width="405" Panel.ZIndex="200" >
            <ax:AxWindowsMediaPlayer x:Name="AxWMP"></ax:AxWindowsMediaPlayer>
        </WindowsFormsHost>

    </Grid>
</Window>
Was it helpful?

Solution

If you are using Visual Studio, you can use the API. To do this:

  1. Right click anywhere in the toolbox
  2. In the COM Components tab, select Windows Media Player
  3. In the toolbox, there should now be a Windows Media Player item.

Using this method makes it much easier and saves a lot of time, if there are any problems take a look at this.

Hope this helps.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top