Share via


Windows Media Player 11 SDK IWMPControls.stop (VB and C#) 

Windows Media Player SDK banner art

Previous Next

IWMPControls.stop (VB and C#)

The stop method stops playback of the media item.

  

Parameters

This method takes no parameters.

Return Value

This method does not return a value.

Remarks

This method causes Windows Media Player to release any system resources it is using, such as the audio device. The current media item, however, is not released.

When Windows Media Player is stopped, the current playback position in the media item is reset to the beginning of the item. Subsequently calling IWMPControls.play will start playback from the beginning of the media item. To halt a play operation without changing the current position, use the IWMPControls.pause method.

Example Code

The following example uses stop to stop the current media item in response to the Click event of a button. The AxWMPLib.AxWindowsMediaPlayer object is represented by the variable named player.

  
Public Sub stopButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles stopButton.Click

    ' To get all of the available functionality of the player controls, Dim the
    ' value returned by player.Ctlcontrols as a WMPLib.IWMPControls3 interface.
    Dim controls As WMPLib.IWMPControls3 = player.Ctlcontrols

    ' Check first to be sure the operation is valid. 
    If (controls.isAvailable("stop")) Then

        controls.stop()

    End If

End Sub

FakePre-055ae1e12db34e67964d6f5c1920fa9e-66258c6a7d274fb5996dd4c88dfaccdb

private void stopButton_Click(object o, System.EventArgs args)
{
    // To get all of the available functionality of the player controls, cast the
    // value returned by player.Ctlcontrols to a WMPLib.IWMPControls3 interface. 
    WMPLib.IWMPControls3 controls = (WMPLib.IWMPControls3)player.Ctlcontrols;

    // Check first to be sure the operation is valid. 
    if (controls.get_isAvailable("stop"))
    {
        controls.stop();
    }
}

Requirements

Version: Windows Media Player 9 Series or later

Namespace: WMPLib

Assembly: Interop.WMPLib.dll (automatically generated by Visual Studio)

See Also

Previous Next