Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.

IVsObjectList2.GetSourceContext Method

Returns a source filename and line number for the given list item.

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

int GetSourceContext(
	uint index,
	IntPtr pszFilename,
	out uint pulLineNum
)

Parameters

index
Type: System.UInt32

[in] Specifies the index of the list item of interest.

pszFilename
Type: System.IntPtr

[out] Pointer to a null-terminated string containing the file name. You must allocate this buffer and free it on the list's final Release, but you can reuse this buffer for multiple calls to this method.

pulLineNum
Type: System.UInt32%

[out] Specifies a line number.

Return Value

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

COM Signature

From vsshell80.idl:

HRESULT IVsObjectList2::GetSourceContext(
   [in] ULONG Index, 
   [out] const WCHAR **pszFileName, 
   [out] ULONG *pulLineNum
);

This method is used to display the source file and line number in the find symbol results window. You can return E_NOTIMPL if you don't want to display this information.

NoteNote:

The text buffer is created by the IVsObjectList2 object and the buffer must persist for the life of the IVsObjectList2 object.

If you are implementing this interface in managed code and you need to have the string disposed of by the caller, implement the IVsCoTaskMemFreeMyStrings interface on the IVsObjectList2 interface.

Community Additions

ADD
Show:
© 2015 Microsoft