IVsUIShell.SetErrorInfo 方法

记录有关错误的丰富信息的帮助器方法。

命名空间:  Microsoft.VisualStudio.Shell.Interop
程序集:  Microsoft.VisualStudio.Shell.Interop(在 Microsoft.VisualStudio.Shell.Interop.dll 中)

语法

声明
Function SetErrorInfo ( _
    hr As Integer, _
    pszDescription As String, _
    dwReserved As UInteger, _
    pszHelpKeyword As String, _
    pszSource As String _
) As Integer
int SetErrorInfo(
    int hr,
    string pszDescription,
    uint dwReserved,
    string pszHelpKeyword,
    string pszSource
)

参数

  • pszDescription
    类型:System.String
    [in] 丰富的错误信息。
  • pszHelpKeyword
    类型:System.String
    [in] 对附加到 帮助 在消息框中按钮的 F1 关键字的指针。此关键字将该环境链接到 (.HxS) 注册的帮助文件与 Visual Studio 帮助集合。有关开发 F1 关键字的更多信息,请参见唯一 F1 关键字。
  • pszSource
    类型:System.String
    [in] 传递给 SetSource 标准 windows ICreateErrorInfo 接口的方法的指针,将类或应用程序的与语言相关的 ProgID 会引发该错误。

返回值

类型:System.Int32
如果方法成功,则返回 S_OK。如果失败,它会返回一个错误代码。

备注

COM 签名

从 vsshell.idl:

HRESULT IVsUIShell::SetErrorInfo(
   [in] HRESULT hr,
   [in] LPCOLESTR pszDescription,
   [in] DWORD dwReserved,
   [in] LPCOLESTR pszHelpKeyword,
   [in] LPCOLESTR pszSource
);

此方法是用于,与 Win32 API SetErrorInfo 函数相同的方式的 helper 函数。 IVsUIShell.SetErrorInfo 方法添加三个参数为原始功能。 前两个参数, dwHelpKeyword 和 pszSource,以适应区分上下文的帮助和语言依赖项。 另一个附加参数, dwreserved,是保留的。

IVsUIShell.SetErrorInfo 方法在 VSPackage 对象中通常会调用该处理命令。 但是,因此,如果您决定使用类似的错误处理方法中,您可以在所有 VSPackage 中使用它。

.NET Framework 安全性

请参见

参考

IVsUIShell 接口

Microsoft.VisualStudio.Shell.Interop 命名空间