Barani
Barani

Reputation: 83

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?)

Upvotes: 5

Views: 9024

Answers (2)

guest
guest

Reputation: 1

See Access denied error when building solution in Visual Studio 2005

This may be caused by Visual Studio requiring administrator rights on Windows 7 or higher.

Upvotes: 0

Alistair McMillan
Alistair McMillan

Reputation: 1179

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.

Upvotes: 4

Related Questions