Share via


Proprietà IWMPError::errorCount

[La funzionalità associata a questa pagina, Lettore multimediale Windows SDK, è una funzionalità legacy. È stata sostituita da MediaPlayer. MediaPlayer è stato ottimizzato per Windows 10 e Windows 11. Microsoft consiglia vivamente che il nuovo codice usi MediaPlayer anziché Lettore multimediale Windows SDK, quando possibile. Microsoft suggerisce che il codice esistente che usa le API legacy venga riscritto per usare le nuove API, se possibile.

La proprietà errorCount ottiene il numero di errori nella coda di errori.

Sintassi

public System.Int32 errorCount {get; set;}

Public ReadOnly Property errorCount As System.Int32

Valore proprietà

System.Int32 che corrisponde al numero di errori.

Commenti

È consigliabile impostare IWMPSettings.enableErrorDialogs su false se si sceglie di visualizzare messaggi di errore personalizzati.

Esempio

Nell'esempio seguente viene usato errorCount in un gestore eventi Error per avvisare l'utente dell'errore più recente nella coda di errori. L'oggetto AxWMPLib.AxWindowsMediaPlayer è rappresentato dalla variabile denominata 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

Requisiti

Requisito Valore
Versione
Lettore multimediale Windows serie 9 o versioni successive
Spazio dei nomi
WMPLib
Assembly
Interop.WMPLib.dll (Interop.WMPLib.dll.dll)

Vedi anche

Interfaccia IWMPError (VB e C#)

IWMPSettings.enableErrorDialogs (VB e C#)