Share via


IWMPControls::currentPosition property

[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 currentPosition property gets or sets the current position in the media item in seconds from the beginning.

Syntax

public System.Double currentPosition {get; set;}

Public Property currentPosition As System.Double

Property value

A System.Double that is the current position.

Examples

The following example uses currentPosition to seek to a position provided by the user. In response to a button click, currentPosition is set to the value entered in a text box called newPosition. The AxWMPLib.AxWindowsMediaPlayer object is represented by the variable named player.

private void setPosition_Click(object sender, System.EventArgs e)
{ 
    // ...Add code to ensure that the text box contains a valid value.
 
    // Set the current position of the media item to the position entered by the user.
    player.Ctlcontrols.currentPosition = Convert.ToDouble(newPosition.Text);
}

Public Sub setPosition_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles setPosition.Click

    ' ...Add code to ensure that the text box contains a valid value.

    ' Set the current position of the media item to the position entered by the user.
    player.Ctlcontrols.currentPosition = Convert.ToDouble(newPosition.Text)

End Sub

Requirements

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

See also

IWMPControls Interface (VB and C#)

IWMPControls.currentPositionString (VB and C#)