Private Sub Text1_MouseUp(Button As Integer, Shift As _
Integer, X As Single, Y As Single)
Dim pos As Long
' Get the position of the bottom of the control.
X = CLng(ScaleX(X, ScaleMode, vbPixels))
Y = CLng(ScaleY(Y, ScaleMode, vbPixels))
' Get the character number
pos = SendMessageLong(Text1.hWnd, EM_CHARFROMPOS, _
0&, X + Y * &H10000) And &HFFFF&
If pos >= Len(Text1.Text) Then
Command1.Enabled = True
End If
End Sub
' See if the last line is visible.
Private Sub Timer1_Timer()
Static done_before As Boolean
Static X As Long
Static Y As Long
Dim r As RECT
Dim pos As Long
' Get text box's client rectangle size.
If Not done_before Then
SendMessageAny Text1.hWnd, EM_GETRECT, 0&, r
X = r.Right - 1
Y = r.Bottom - 1
done_before = True
End If
' Get the character number
pos = SendMessageLong(Text1.hWnd, _
EM_CHARFROMPOS, 0&, X + Y * &H10000) _
And &HFFFF&
If pos >= Len(Text1.Text) Then
Command1.Enabled = True
Timer1.Enabled = False
End If
End Sub
|