Compartilhar via


IVsUIShell.SetErrorInfo Method

Helper method that records rich information about an error.

Namespace:  Microsoft.VisualStudio.Shell.Interop
Assembly:  Microsoft.VisualStudio.Shell.Interop (in Microsoft.VisualStudio.Shell.Interop.dll)

Syntax

'Declaration
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
)
int SetErrorInfo(
    [InAttribute] int hr, 
    [InAttribute] String^ pszDescription, 
    [InAttribute] unsigned int dwReserved, 
    [InAttribute] String^ pszHelpKeyword, 
    [InAttribute] String^ pszSource
)
abstract SetErrorInfo : 
        hr:int * 
        pszDescription:string * 
        dwReserved:uint32 * 
        pszHelpKeyword:string * 
        pszSource:string -> int
function SetErrorInfo(
    hr : int, 
    pszDescription : String, 
    dwReserved : uint, 
    pszHelpKeyword : String, 
    pszSource : String
) : int

Parameters

  • hr
    Type: Int32

    [in] Error message to display.

  • pszDescription
    Type: String

    [in] Rich error information.

  • dwReserved
    Type: UInt32

    [in] Must be zero.

  • pszHelpKeyword
    Type: String

    [in] Pointer to the F1 keyword to attach to the Help button on the message box. This keyword links through the environment to a Help file (.HxS) registered with the Visual Studio Help collection. For more information about developing F1 keywords, see Unique F1 Keywords.

  • pszSource
    Type: String

    [in] Pointer to pass to the SetSource method of the standard Windows ICreateErrorInfo interface, which sets the language-dependent ProgID for the class or application that raised the error.

Return Value

Type: Int32
If the method succeeds, it returns S_OK. If it fails, it returns an error code.

Remarks

COM Signature

From vsshell.idl:

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

This method is a helper function that you employ in the same way as the Win32 API SetErrorInfo function. The IVsUIShell.SetErrorInfo method adds three parameters to the original function. The last two parameters, dwHelpKeyword and pszSource, accommodate context-sensitive help and language dependencies. The other additional parameter, dwreserved, is reserved.

The IVsUIShell.SetErrorInfo method is typically called within VSPackage objects that handle commands. However, you can use it in any VSPackage if you elect to use a similar error handling strategy.

.NET Framework Security

See Also

Reference

IVsUIShell Interface

Microsoft.VisualStudio.Shell.Interop Namespace