Share via


IWMPError::errorCount property

[The feature associated with this page, Windows Media Player SDK, is a legacy feature. It has been superseded by MediaPlayer. MediaPlayer has been optimized for Windows 10 and Windows 11. Microsoft strongly recommends that new code use MediaPlayer instead of Windows Media Player SDK, when possible. Microsoft suggests that existing code that uses the legacy APIs be rewritten to use the new APIs if possible.]

The errorCount property gets the number of errors in the error queue.

Syntax

public System.Int32 errorCount {get; set;}

Public ReadOnly Property errorCount As System.Int32

Property value

A System.Int32 that is the number of errors.

Remarks

You should set IWMPSettings.enableErrorDialogs to false if you choose to display custom error messages.

Examples

The following example uses errorCount in an Error event handler to alert the user about the most recent error in the error queue. The AxWMPLib.AxWindowsMediaPlayer object is represented by the variable named 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

Requirements

Requirement Value
Version
Windows Media Player 9 Series or later
Namespace
WMPLib
Assembly
Interop.WMPLib.dll (Interop.WMPLib.dll.dll)

See also

IWMPError Interface (VB and C#)

IWMPSettings.enableErrorDialogs (VB and C#)