IWMPError::clearErrorQueue 方法
[与此页面关联的功能(Windows 媒体播放器 SDK)是旧版功能。 它已被 MediaPlayer 取代。 MediaPlayer 已针对Windows 10和Windows 11进行了优化。 如果可能,Microsoft 强烈建议新代码使用 MediaPlayer 而不是 Windows 媒体播放器 SDK。 如果可能,Microsoft 建议重写使用旧 API 的现有代码以使用新 API。]
clearErrorQueue 方法从错误队列中清除错误。
语法
public void clearErrorQueue();
Public Sub clearErrorQueue()
Implements IWMPError.clearErrorQueue
参数
此方法没有任何参数。
返回值
此方法不返回值。
备注
在处理一系列错误后,使用此方法清除错误队列。
如果选择显示自定义错误消息,则应将 IWMPSettings.enableErrorDialogs 设置为 false 。
示例
以下示例在错误事件处理程序中使用 clearErrorQueue 在显示所有错误说明后清空错误队列。 AxWMPLib.AxWindowsMediaPlayer 对象由名为 player 的变量表示。
private void player_ErrorEvent_clearErrorQueue(object sender, System.EventArgs e)
{
// Store the number of errors in the queue.
int max = player.Error.errorCount;
// Loop through the list of errors.
for (int i = 0; i < max; i++)
{
// Get the description for this error.
string errDesc = player.Error.get_Item(i).errorDescription;
// Display the error message.
System.Windows.Forms.MessageBox.Show(errDesc);
}
// Clear the error queue to prepare for the next group of errors.
player.Error.clearErrorQueue();
}
Public Sub player_ErrorEvent_clearErrorQueue(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
' Loop through the list of errors.
For i As Integer = 0 To (max - 1)
' Get the description for this error.
Dim errDesc As String = player.Error.Item(i).errorDescription
' Display the error message.
System.Windows.Forms.MessageBox.Show(errDesc)
Next i
' Clear the error queue to prepare for the next group of errors.
player.Error.clearErrorQueue()
End Sub
要求
要求 | 值 |
---|---|
版本 |
Windows 媒体播放器 9 系列或更高版本 |
命名空间 |
WMPLib |
程序集 |
|
另请参阅
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈