Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
.gif)
| Previous | Next |
AxWindowsMediaPlayer.CurrentItemChange Event (VB and C#)
The CurrentItemChange event occurs when the value of IWMPControls.currentItem changes.
[Visual Basic] Private Sub player_CurrentItemChange( sender As Object, e As _WMPOCXEvents_CurrentItemChangeEvent ) Handles player.CurrentItemChange [C#]
Event Data
The handler associated with this event is of type AxWMPLib._WMPOCXEvents_CurrentItemChangeEventHandler. This handler receives an argument of type AxWMPLib._WMPOCXEvents_CurrentItemChangeEvent, which contains the following property related to this event.
| Property | Description |
| pdispMedia | System.Object
The new current media item. You can cast this to an IWMPMedia interface to access it. |
Example Code
The following example demonstrates an event handler for the CurrentItemChange event. The AxWMPLib.AxWindowsMediaPlayer object is represented by the variable named player.
[Visual Basic]
Public Sub player_CurrentItemChange(ByVal sender As Object, ByVal e As AxWMPLib._WMPOCXEvents_CurrentItemChangeEvent) Handles player.CurrentItemChange
' Display the name of the new media item.
mediaText.Text = player.currentMedia.name
End Sub
FakePre-a6285d8a1c2c4162bbdcfe051d3552b0-fbc16cabb3314f4fb167c492f4d3718f
// Add a delegate for the CurrentItemChange event
player.CurrentItemChange += new AxWMPLib._WMPOCXEvents_CurrentItemChangeEventHandler(player_CurrentItemChange);
private void player_CurrentItemChange(object sender, AxWMPLib._WMPOCXEvents_CurrentItemChangeEvent e)
{
// Display the name of the new media item.
mediaText.Text = player.currentMedia.name;
}
Requirements
Version: Windows Media Player 9 Series or later
Namespace: AxWMPLib
Assembly: AxInterop.WMPLib.dll (automatically generated by Visual Studio)
See Also
- AxWindowsMediaPlayer Object (VB and C#)
- IWMPControls.currentItem (VB and C#)
- IWMPMedia Interface (VB and C#)
| Previous | Next |