.NET/Windows API for .NET
GetCaretPos - 표시되는 Caret의 위치반환
클리엘
2019. 8. 12. 13:23
728x90
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값을 반환합니다.
728x90