IWMPErrorItem::errorCode 属性
[与此页面关联的功能(Windows 媒体播放器 SDK)是旧版功能。 它已被 MediaPlayer 取代。 MediaPlayer 已针对Windows 10和Windows 11进行了优化。 Microsoft 强烈建议新代码尽可能使用 MediaPlayer 而不是 Windows 媒体播放器 SDK。 如果可能,Microsoft 建议重写使用旧 API 的现有代码以使用新 API。]
errorCode 属性获取当前错误代码。
语法
public System.Int32 errorCode {get; set;}
Public ReadOnly Property errorCode As System.Int32
属性值
作为错误代码的 System.Int32 。
备注
如果选择显示自定义错误消息,则应将 IWMPSettings.enableErrorDialogs 设置为 false 。
示例
以下示例使用 Error 事件处理程序中的 errorCode 向用户显示错误代码。 AxWMPLib.AxWindowsMediaPlayer 对象由名为 player 的变量表示。
private void player_ErrorEvent_errorCode(object sender, System.EventArgs e)
{
// Get the error code for the first error item.
int errCode = player.Error.get_Item(0).errorCode;
// Display the error code.
System.Windows.Forms.MessageBox.Show("Error number: " + errCode.ToString());
}
Public Sub player_ErrorEvent_errorCode(ByVal sender As Object, ByVal e As System.EventArgs) Handles player.ErrorEvent
' Get the error code for the first error item.
Dim errCode As Integer = player.Error.Item(0).errorCode
' Display the error code.
System.Windows.Forms.MessageBox.Show("Error number: " + errCode.ToString())
End Sub
要求
要求 | 值 |
---|---|
版本 |
Windows 媒体播放器 9 系列或更高版本 |
命名空间 |
WMPLib |
程序集 |
|
另请参阅
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈