Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ErrorThe type or namespace name 'AxWMPLib' could not be found (are you missing a using directive or an assembly reference?)

What is the possible reference for the handler AxWMPLib._WMPOCXEvents_PlayStateChangeEventHandler ?

When I pass this event in the method,

private void axWindowsMediaPlayer1_PlayStateChange(object sender,AxWMPLib._WMPOCXEvents_PlayStateChangeEvent e)

Compiling throws the following error:

The type or namespace name 'AxWMPLib' could not be found (are you missing a using directive or an assembly reference?)

like image 705
Barani Avatar asked Sep 28 '22 19:09

Barani


1 Answers

If you are using Visual Studio then make sure you have AxWMPLib listed under References in Solution Explorer. If you have an embedded Windows Media Player control in a form, it should have been added automatically along with WMPLib.

An easy way to add these libraries if they are missing is to add a Windows Media Player control to a form (an existing one will do). Right-click on the Toolbox and pick "Choose Items..." from the context menu, then tick the "Windows Media Player" control on the "COM components" tab and click OK. You should now have a little Windows Media Player icon attached to your cursor; click on the form to add it. This will add the AxWMPLib and WMPLib references to your solution. You can then delete the Windows Media Player control you just added if you don't need it.

like image 101
Alistair McMillan Avatar answered Oct 06 '22 01:10

Alistair McMillan