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

 

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)

int CopyLineText(
	int iStartLine,
	int iStartIndex,
	int iEndLine,
	int iEndIndex,
	IntPtr pszBuf,
	int% pcchBuf
)

Parameters

iStartLine
Type: System::Int32

[in] Starting line

iStartIndex
Type: System::Int32

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

iEndLine
Type: System::Int32

[in] Ending line

iEndIndex
Type: System::Int32

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

pszBuf
Type: System::IntPtr

[in] Text to insert, if any

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.

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.

System_CAPS_noteNote

 pcchBuf contains a count of UNICODE CHARACTERS, not BYTES.

To get the required size, you can set pszBuf to null.

Return to top
Show: