Share via


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

Windows Media Player SDK banner art

Previous Next

IWMPControls.pause (VB and C#)

The pause method pauses playback of the media item.

  

Parameters

This method takes no parameters.

Return Value

This method does not return a value.

Remarks

When a file is paused, Windows Media Player does not give up any system resources, such as the audio device.

To determine whether a particular media type can be paused, pass the System.String value "pause" to the IWMPControls.isAvailable property (the IWMPControls.get_isAvailable method in C#).

Example Code

The following example uses pause to pause playback of 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 pauseButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles pauseButton.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("pause")) Then

        controls.pause()

    End If

End Sub

FakePre-aa0d87a49eaa450396d55de5f8d452d3-df96576eb65f4085b23cbba25a291dbb

private void pauseButton_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("pause"))
    {
        controls.pause();
    }
}

Requirements

Version: Windows Media Player 9 Series or later

Namespace: WMPLib

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

See Also

Previous Next