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?)
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With