Share via


Windows Media Player 11 SDK IWMPError.errorCount (VB and C#) 

Windows Media Player SDK banner art

IWMPError.errorCount (VB and C#)

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

[Visual Basic]
ReadOnly Property errorCount As Integer

[C#]
int errorCount {get;}

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.

Example Code

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.

[Visual Basic]
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

FakePre-97823663d0514b91904de27f7cd38118-75d75a871515443485b063d20321f745

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);
}

Requirements

Version: Windows Media Player 9 Series or later

Namespace: WMPLib

Assembly: Interop.WMPLib.dll (automatically generated by Visual Studio)

See Also