(Q) Can I change the normal line cursor while editing in a textbox?
(A) Yes, you can control the length and width of the cursor by using
the CreateCaret API.
Note: Make sure you copy the
fhWnd
function as well.
Private Declare Function apiCreateCaret Lib "user32" _
Alias "CreateCaret" _
(ByVal hWnd As Long, _
ByVal hBitmap As Long, _
ByVal nWidth As Long, _
ByVal nHeight As Long) _
As Long
Private Declare Function apiShowCaret Lib "user32" _
Alias "ShowCaret" _
(ByVal hWnd As Long) _
As Long
Sub sMakeCaret(ctl As Control, _
intX As Integer, _
intY As Integer)
Dim hWnd As Long
hWnd = fhWnd(ctl)
Call apiCreateCaret(hWnd, 0&, intX, intY)
Call apiShowCaret(hWnd)
End Sub
|