Partager via


IVsTextLayer.CopyLineText Method

Puts the specified span of text into a caller-allocated buffer

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

Syntax

'Déclaration
Function CopyLineText ( _
    iStartLine As Integer, _
    iStartIndex As Integer, _
    iEndLine As Integer, _
    iEndIndex As Integer, _
    pszBuf As IntPtr, _
    <OutAttribute> ByRef pcchBuf As Integer _
) As Integer
int CopyLineText(
    int iStartLine,
    int iStartIndex,
    int iEndLine,
    int iEndIndex,
    IntPtr pszBuf,
    out int pcchBuf
)
int CopyLineText(
    [InAttribute] int iStartLine, 
    [InAttribute] int iStartIndex, 
    [InAttribute] int iEndLine, 
    [InAttribute] int iEndIndex, 
    [InAttribute] IntPtr pszBuf, 
    [InAttribute] [OutAttribute] int% pcchBuf
)
abstract CopyLineText : 
        iStartLine:int * 
        iStartIndex:int * 
        iEndLine:int * 
        iEndIndex:int * 
        pszBuf:IntPtr * 
        pcchBuf:int byref -> int 
function CopyLineText(
    iStartLine : int, 
    iStartIndex : int, 
    iEndLine : int, 
    iEndIndex : int, 
    pszBuf : IntPtr, 
    pcchBuf : int
) : int

Parameters

  • iStartIndex
    Type: System.Int32
    [in] Starting character index within the line (must be <= length of line)
  • iEndIndex
    Type: System.Int32
    [in] Ending character index within the line (must be <= length of line)
  • pcchBuf
    Type: System.Int32%
    [in, out] On input, the number of characters to copy. On output, the required size of the buffer. Count is UNICODE characters, not bytes.

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 textmgr.idl:

HRESULT IVsTextLayer::CopyLineText(
   [in] long iStartLine,
   [in] CharIndex iStartIndex,
   [in] long iEndLine,
   [in] CharIndex iEndIndex,
   [in] LPWSTR pszBuf,
   [in, out] long * pcchBuf
);

CopyLineText will copy up to cchBuf characters. If the buffer isn't big enough, CopyLineText returns BUFFER_E_DEST_TOO_SMALL and sets * to the required size.

Note

pcchBuf contains a count of UNICODE CHARACTERS, not BYTES.

To get the required size, you can set pszBuf to nulla null reference (Nothing in Visual Basic).

.NET Framework Security

See Also

Reference

IVsTextLayer Interface

Microsoft.VisualStudio.TextManager.Interop Namespace