Programming/Windows API
GetCaretPos 함수는 Caret이 표시되는 위치값을 반환합니다.

Declare Function GetCaretPos Lib "user32" Alias "GetCaretPos" (ByRef lpPoint As POINTAPI) As Integer
▶VB.NET 선언

Public Structure POINTCRT
        Public x As Integer
        Public y As Integer
End Structure

Dim pt As POINTCRT
GetCaretPos(pt)
pt.x
pt.y

▶VB.NET 호출

[DllImport("user32.dll")]
public static extern int GetCaretPos(ref POINTCRT hwnd);
▶C# 선언

public struct POINTCRT{
            public int x;
            public int y;
};

POINTCRT pt = new POINTCRT();
GetCaretPos(ref pt);
pt.x
pt.y

▶C# 호출

GetCaretPos 함수는 실행에 실패할 경우 0값을 반환합니다.
0 0