Share via


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

Windows Media Player SDK banner art

Previous Next

IWMPControls.currentPositionString (VB and C#)

The currentPositionString property gets the current position in the media item as a string formatted as HH:MM:SS (hours, minutes, and seconds).

  

Property Value

A formatted System.String that is the current position.

Remarks

If the media item is less than an hour long, the current position is formatted as MM:SS (minutes and seconds).

Example Code

The following example starts a timer that triggers an event at one-second intervals. In the timer event handler, a label is updated with the currentPositionString. The AxWMPLib.AxWindowsMediaPlayer object is represented by the variable named player.

  
' Set the timer to fire an event every second and start the timer.
timer.Interval = 1000
timer.Start()

' Note:  Use the AxWindowsMediaPlayer.PlayStateChange event with a switch statement to
' determine when to start and stop the timer. 

' Update the text of the label with the currentPositionString.
Public Sub TimerEventProcessor(ByVal sender As Object, ByVal e As System.EventArgs) Handles timer.Tick

    currentPositionLabel.Text = player.Ctlcontrols.currentPositionString

End Sub

FakePre-9251c1e721bb468d8ae6a16bc1b69676-435931f85ad945de86938910423d5336

// Set the timer to fire an event every second and start the timer.
timer.Interval = 1000;
timer.Start();

// Note:  Use the AxWindowsMediaPlayer.PlayStateChange event with a switch statement to
// determine when to start and stop the timer. 
   
// Update the text of the label with the currentPositionString.
private void TimerEventProcessor(object sender, System.EventArgs e)
{
    currentPositionLabel.Text = player.Ctlcontrols.currentPositionString;
}

Requirements

Version: Windows Media Player 9 Series or later

Namespace: WMPLib

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

See Also

Previous Next