다음을 통해 공유


IWMPControls::currentPositionString 속성

[이 페이지와 연결된 기능인 Windows 미디어 플레이어 SDK는 레거시 기능입니다. MediaPlayer로 대체되었습니다. MediaPlayer는 Windows 10 및 Windows 11 최적화되었습니다. 가능한 경우 새 코드에서 Windows 미디어 플레이어 SDK 대신 MediaPlayer를 사용하는 것이 좋습니다. 가능한 경우 레거시 API를 사용하는 기존 코드를 다시 작성하여 새 API를 사용하도록 제안합니다.]

currentPositionString 속성은 미디어 항목의 현재 위치를 HH:MM:SS(시간, 분 및 초)로 형식이 지정된 문자열로 가져옵니다.

이 속성은 읽기 전용입니다.

구문

public System.String currentPositionString {get;}

Public ReadOnly Property currentPositionString As System.String

속성 값

현재 위치인 형식이 지정된 System.String 입니다.

설명

미디어 항목이 1시간 미만인 경우 현재 위치는 MM:SS(분 및 초)로 형식이 지정됩니다.

예제

다음 예제에서는 1초 간격으로 이벤트를 트리거하는 타이머를 시작합니다. 타이머 이벤트 처리기에서 레이블은 currentPositionString으로 업데이트됩니다. AxWMPLib.AxWindowsMediaPlayer 개체는 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.
private void TimerEventProcessor(object sender, System.EventArgs e)
{
    currentPositionLabel.Text = player.Ctlcontrols.currentPositionString;
}

' 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

요구 사항

요구 사항
버전
Windows 미디어 플레이어 9 시리즈 이상
네임스페이스
WMPLib
어셈블리
Interop.WMPLib.dll(Interop.WMPLib.dll.dll)

추가 정보

IWMPControls 인터페이스(VB 및 C#)

IWMPControls.currentPosition(VB 및 C#)