Partager via


ErrorItem.errorCode

[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 errorCode property retrieves the current error code.

player.error.item(
        index
        ).errorCode

Possible Values

This property is a read-only Number (long).

Remarks

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

Examples

The following JScript example uses ErrorItem.errorCode in an event handler to display the error code to the user. The Player object was created with ID = "Player".

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

// Get the error code for the first error item.
errNum = Player.error.item(0).errorCode;

// Display the error information.
var message = "Error number: " + errNum);
message += "<BR>";
message += "Use your BACK button to return ";
message += "to the previous page.";
document.write(message);

</SCRIPT>

Requirements

Requirement Value
Version
Windows Media Player version 7.0 or later.
DLL
Wmp.dll

See also

ErrorItem Object

ErrorItem.errorDescription