Does anyone know how to get the x,y value of the current cursor position in a textbox? Preferably with a small api, but any method would be appreciated. Thanks
Printable View
Does anyone know how to get the x,y value of the current cursor position in a textbox? Preferably with a small api, but any method would be appreciated. Thanks
Code:Ibeam = Text1.SelStart
hmm... the X and the Y you ask?
Have you tried this?
oh and for the api to get the screen coordinatesCode:Private Sub Text1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Text1.Text = X & " & " & Y
End Sub
In the first code x = 0 when the mouse is at the left of the textbox, in the second code x = 0 when the mouse is at the left of the screen.Code:Option Explicit
Private Type POINTAPI
X As Long
Y As Long
End Type
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Sub Text1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim Pnt As POINTAPI
GetCursorPos Pnt
Text1.Text = Pnt.X & " & " & Pnt.Y
End Sub
Have fun!
[Edited by Jop on 10-20-2000 at 06:22 PM]
Jop i meant the x and y of the blinking cursor, not the mouse