Share via


IVsTextLayer.CopyLineText(Int32, Int32, Int32, Int32, IntPtr, Int32) Method

Definition

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

public:
 int CopyLineText(int iStartLine, int iStartIndex, int iEndLine, int iEndIndex, IntPtr pszBuf, [Runtime::InteropServices::Out] int % pcchBuf);
public int CopyLineText (int iStartLine, int iStartIndex, int iEndLine, int iEndIndex, IntPtr pszBuf, out int pcchBuf);
abstract member CopyLineText : int * int * int * int * nativeint * int -> int
Public Function CopyLineText (iStartLine As Integer, iStartIndex As Integer, iEndLine As Integer, iEndIndex As Integer, pszBuf As IntPtr, ByRef pcchBuf As Integer) As Integer

Parameters

iStartLine
Int32

[in] Starting line

iStartIndex
Int32

[in] Starting character index within the line (must be <= length of line)

iEndLine
Int32

[in] Ending line

iEndIndex
Int32

[in] Ending character index within the line (must be <= length of line)

pszBuf
IntPtr

nativeint

[in] Text to insert, if any

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

Returns

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

Applies to