This topic has not yet been rated - Rate this topic

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)
int SetErrorInfo(
	int hr,
	string pszDescription,
	uint dwReserved,
	string pszHelpKeyword,
	string pszSource
)

Parameters

hr
Type: System.Int32

[in] Error message to display.

pszDescription
Type: System.String

[in] Rich error information.

dwReserved
Type: System.UInt32

[in] Must be zero.

pszHelpKeyword
Type: System.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: System.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: System.Int32
If the method succeeds, it returns S_OK. If it fails, it returns an error code.

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.

Did you find this helpful?
(1500 characters remaining)

Community Additions

ADD
© 2013 Microsoft. All rights reserved.