IVsTextView.GetCaretPos Method
Returns the line and column index of the cursor position.
Namespace: Microsoft.VisualStudio.TextManager.Interop
Assembly: Microsoft.VisualStudio.TextManager.Interop (in Microsoft.VisualStudio.TextManager.Interop.dll)
Syntax
'宣言
Function GetCaretPos ( _
<OutAttribute> ByRef piLine As Integer, _
<OutAttribute> ByRef piColumn As Integer _
) As Integer
'使用
Dim instance As IVsTextView
Dim piLine As Integer
Dim piColumn As Integer
Dim returnValue As Integer
returnValue = instance.GetCaretPos(piLine, _
piColumn)
int GetCaretPos(
out int piLine,
out int piColumn
)
int GetCaretPos(
[OutAttribute] int% piLine,
[OutAttribute] int% piColumn
)
function GetCaretPos(
piLine : int,
piColumn : int
) : int
Parameters
piLine
Type: System.Int32%[out] Pointer to an integer containing the line, if the method succeeds.
piColumn
Type: System.Int32%[out] Pointer to an integer containing the column, if the method succeeds. Viewcol coordinates may include virtual space.
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 IVsTextView::GetCaretPos(
[out] long *piLine,
[out] ViewCol *piColumn
);
The caret position is the cursor position. Use GetCaretPos to manage the caret or the insertion point. The piLine or piColumn parameters can be a null reference (Nothing in Visual Basic) if only one is needed.
Permissions
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.