IWMPMedia::getMarkerName 方法
[与此页面关联的功能(Windows 媒体播放器 SDK)是旧版功能。 它已被 MediaPlayer 取代。 MediaPlayer 已针对Windows 10和Windows 11进行了优化。 如果可能,Microsoft 强烈建议新代码使用 MediaPlayer 而不是 Windows 媒体播放器 SDK。 如果可能,Microsoft 建议重写使用旧 API 的现有代码以使用新 API。]
getMarkerName 方法返回指定索引处的标记的名称。
语法
public System.String getMarkerName(
System.Int32 MarkerNum
);
Public Function getMarkerName( _
ByVal MarkerNum As System.Int32 _
) As System.String
Implements IWMPMedia.getMarkerName
参数
-
MarkerNum [in]
-
作为标记索引的 System.Int32 。
返回值
作为标记名称的 System.String 。
备注
如果指定的标记不存在,则此方法返回 NULL 。
某些媒体项不包含标记。 使用 markerCount 可找出当前媒体项中的标记数。
标记索引号从 1 开始。
在调用此方法之前,必须具有对库的读取访问权限。 有关详细信息,请参阅 库访问。
示例
下面的代码示例使用 getMarkerName 使用当前媒体项中的标记名称填充多行文本框。 AxWMPLib.AxWindowsMediaPlayer 对象由名为 player 的变量表示。
// Get the number of markers in the current media item.
int mcount = player.currentMedia.markerCount;
// Create an array to store the list of marker names
string[] markers = new string[mcount];
// Verify that at least one marker exists in the current media.
if (mcount > 0)
{
// Loop through the marker list.
for (int i = 1; i < mcount + 1; i++)
{
// Store the marker name in the array.
markers[i] = player.currentMedia.getMarkerName(i);
}
// Display the marker names in the text box.
markerNames.Lines = markers;
}
' Get the number of markers in the current media item.
Dim mCount As Integer = player.currentMedia.markerCount
' Create an array to store the list of marker names
Dim markers(mCount) As String
' Verify that at least one marker exists in the current media.
If (mCount > 0) Then
' Loop through the marker list.
For i As Integer = 1 To mCount
' Store the marker name in the array.
markers(i) = player.currentMedia.getMarkerName(i)
Next i
End If
' Display the marker names in the text box.
markerNames.Lines = markers
要求
要求 | 值 |
---|---|
版本 |
Windows 媒体播放器 9 系列或更高版本 |
命名空间 |
WMPLib |
程序集 |
|
另请参阅
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈