Share via


AxWindowsMediaPlayer.close method

[The feature associated with this page, Windows Media Player SDK, is a legacy feature. It has been superseded by MediaPlayer. MediaPlayer has been optimized for Windows 10 and Windows 11. Microsoft strongly recommends that new code use MediaPlayer instead of Windows Media Player SDK, when possible. Microsoft suggests that existing code that uses the legacy APIs be rewritten to use the new APIs if possible.]

The close method closes the current digital media file, stops playback in Windows Media Player and releases Windows Media Player resources.

Syntax

public void close();

Public Sub close()

Parameters

This method has no parameters.

Return value

This method does not return a value.

Remarks

This method closes the current digital media file, not Windows Media Player itself.

Examples

The following example creates a button that, when clicked, stops playback in Windows Media Player and releases the resources in use. The AxWMPLib.AxWindowsMediaPlayer object is represented by the variable named player.

private void closeIt_Click(object sender, System.EventArgs e)
{
    // Close the Player. 
    player.close();
}

Public Sub closeIt_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles closeIt.Click

    ' Close the Player. 
    player.close()

End Sub

Requirements

Requirement Value
Version
Windows Media Player 9 Series or later
Namespace
AxWMPLib
Assembly
AxInterop.WMPLib.dll (AxInterop.WMPLib.dll.dll)

See also

AxWindowsMediaPlayer Object (VB and C#)