Compartir a través de


IVsObjectList.GetSourceContext Method

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

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

Syntax

'Declaración
Function GetSourceContext ( _
    index As UInteger, _
    pszFilename As IntPtr, _
    <OutAttribute> ByRef pulLineNum As UInteger _
) As Integer
'Uso
Dim instance As IVsObjectList
Dim index As UInteger
Dim pszFilename As IntPtr
Dim pulLineNum As UInteger
Dim returnValue As Integer

returnValue = instance.GetSourceContext(index, _
    pszFilename, pulLineNum)
int GetSourceContext(
    uint index,
    IntPtr pszFilename,
    out uint pulLineNum
)
int GetSourceContext(
    [InAttribute] unsigned int index, 
    [InAttribute] IntPtr pszFilename, 
    [OutAttribute] unsigned int% pulLineNum
)
abstract GetSourceContext : 
        index:uint32 * 
        pszFilename:IntPtr * 
        pulLineNum:uint32 byref -> int 
function GetSourceContext(
    index : uint, 
    pszFilename : IntPtr, 
    pulLineNum : uint
) : int

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.

Return Value

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

Remarks

COM Signature

From vsshell.idl:

HRESULT IVsObjectList::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.

Nota

The text buffer is created by the IVsObjectList object and the buffer must persist for the life of the IVsObjectList 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 IVsObjectList interface.

.NET Framework Security

See Also

Reference

IVsObjectList Interface

IVsObjectList Members

Microsoft.VisualStudio.Shell.Interop Namespace