Share via


IVsUIShell.SetErrorInfo(Int32, String, UInt32, String, String) Method

Definition

Helper method that records rich information about an error.

public:
 int SetErrorInfo(int hr, System::String ^ pszDescription, System::UInt32 dwReserved, System::String ^ pszHelpKeyword, System::String ^ pszSource);
public:
 int SetErrorInfo(int hr, Platform::String ^ pszDescription, unsigned int dwReserved, Platform::String ^ pszHelpKeyword, Platform::String ^ pszSource);
int SetErrorInfo(int hr, std::wstring const & pszDescription, unsigned int dwReserved, std::wstring const & pszHelpKeyword, std::wstring const & pszSource);
public int SetErrorInfo (int hr, string pszDescription, uint dwReserved, string pszHelpKeyword, string pszSource);
abstract member SetErrorInfo : int * string * uint32 * string * string -> int
Public Function SetErrorInfo (hr As Integer, pszDescription As String, dwReserved As UInteger, pszHelpKeyword As String, pszSource As String) As Integer

Parameters

hr
Int32

[in] Error message to display.

pszDescription
String

[in] Rich error information.

dwReserved
UInt32

[in] Must be zero.

pszHelpKeyword
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
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.

Returns

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.

Applies to