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 。
範例
下列範例會在顯示所有錯誤描述之後,在 Error 事件處理常式中使用 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 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應