Error.errorCount

[與此頁面相關聯的功能Windows 媒體播放機 SDK是舊版功能。 MediaPlayer已取代它。 MediaPlayer已針對Windows 10和Windows 11進行優化。 Microsoft 強烈建議新程式碼盡可能使用MediaPlayer,而不是Windows 媒體播放機 SDK。 Microsoft 建議使用舊版 API 的現有程式碼盡可能重寫為使用新的 API。

errorCount屬性會擷取錯誤佇列中的錯誤數目。

player.error.errorCount
      

可能的值

此屬性是唯讀 的數位 () 。

備註

您應該設定 [設定]。如果您選擇顯示自訂錯誤訊息,enableErrorDialogs 為 false。

範例

下列 JScript 範例使用 Error。事件處理常式中的errorCount ,以警示使用者錯誤佇列中最近的錯誤。 Player物件是以識別碼 = 「Player」 建立的。

<SCRIPT LANGUAGE = "JScript"  FOR = Player  EVENT = error()>

// Store the number of errors in the queue.
var 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.
var errDesc = Player.error.item(max-1).errorDescription;

// Display the error description.
alert(errDesc);

</SCRIPT>

規格需求

需求
版本
Windows 媒體播放機 7.0 版或更新版本。
DLL
Wmp.dll

另請參閱

Error 物件