Change The Caret Of A Text Box

'Add a module to your project (In the menu choose Project -> Add Module, Then click Open)
'Add 2 Text Boxes and 1 PictureBox to your form. Add BMP Picture to the Picture Box.
'This Picture will be Text1 Caret.
'Insert this code to the module :

Declare Function CreateCaret Lib "user32" (ByVal hwnd As Long, _
ByVal hBitmap As Long, ByVal nWidth As Long, ByVal nHeight As Long) As Long
Declare Function ShowCaret Lib "user32" (ByVal hwnd As Long) As Long
Declare Function GetFocus Lib "user32" () As Long

'Insert this code to your form:

Private Sub Text1_GotFocus()
h& = GetFocus&()
b& = Picture1.Picture
Call CreateCaret(h&, b&, 10, 10)
X& = ShowCaret&(h&)
End Sub

Private Sub Text2_GotFocus()
h& = GetFocus&()
'The '25' below is the Caret Width. The '30' Below is the Caret High
Call CreateCaret(h&, 0, 25, 30)
X& = ShowCaret&(h&)
End Sub

Go Back