IWMPError::errorCount 属性
[与此页面关联的功能(Windows 媒体播放器 SDK)是旧版功能。 它已被 MediaPlayer 取代。 MediaPlayer 已针对Windows 10和Windows 11进行了优化。 Microsoft 强烈建议新代码尽可能使用 MediaPlayer 而不是 Windows 媒体播放器 SDK。 如果可能,Microsoft 建议重写使用旧 API 的现有代码以使用新 API。]
errorCount 属性获取错误队列中的错误数。
语法
public System.Int32 errorCount {get; set;}
Public ReadOnly Property errorCount As System.Int32
属性值
一个 System.Int32 ,即错误数。
备注
如果选择显示自定义错误消息,则应将 IWMPSettings.enableErrorDialogs 设置为 false 。
示例
以下示例使用 Error 事件处理程序中的 errorCount 向用户发出错误队列中最新错误的警报。 AxWMPLib.AxWindowsMediaPlayer 对象由名为 player 的变量表示。
private void player_ErrorEvent_errorCount(object sender, System.EventArgs e)
{
// Store the number of errors in the queue.
int max = player.Error.errorCount;
// Get the description of the last error. Error items start at zero,
// so the item index will always be one less than the error count.
string errDesc = player.Error.get_Item(max-1).errorDescription;
// Display the error description.
System.Windows.Forms.MessageBox.Show(errDesc);
}
Public Sub player_ErrorEvent_errorCount(ByVal sender As Object, ByVal e As System.EventArgs) Handles player.ErrorEvent
' Store the number of errors in the queue.
Dim max As Integer = player.Error.errorCount
' Get the description of the last error. Error items start at zero,
' so the item index will always be one less than the error count.
Dim errDesc As String = player.Error.Item(max - 1).errorDescription
' Display the error description.
System.Windows.Forms.MessageBox.Show(errDesc)
End Sub
要求
要求 | 值 |
---|---|
版本 |
Windows 媒体播放器 9 系列或更高版本 |
命名空间 |
WMPLib |
程序集 |
|
另请参阅
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈