Changing the cursor in a textbox.

Hi,
how can i change the cursor that blinks in a textbox,
from a vertical one to horizontal - like dos?
but what i realy need is that the cursor will be like a small green sqaure that when
i move the cursor with the left or right key he will highlight the next letter in the textbox.
thanks...
KinGuyAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ryan ChongCommented:
Try use CreateCaret API:

Example:

'On form1 place 2 textboxes (with a height for a couple of lines) and 1 picturebox.
'Select a bitmap for the picturebox and set the autosize on true.
Private Declare Function CreateCaret Lib "user32" (ByVal hwnd As Long, ByVal hBitmap As Long, ByVal nWidth As Long, ByVal nHeight As Long) As Long
Private Declare Function ShowCaret Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function GetFocus Lib "user32" () As Long
Private Sub Form_Load()
    'KPD-Team 1999
    'URL: http://www.allapi.net/
    'E-Mail: KPDTeam@Allapi.net

    'Execute the app. (F5) and you'll see the difference of the cursorshapes.
End Sub
Sub Text1_GotFocus()
    'retrieve the window which has the focus
    h& = GetFocus&()
    'retrieve the handle of our picture
    b& = Picture1.Picture
    'Create a new cursor
    '(handle, bitmap 0=none, width, height)
    Call CreateCaret(h&, b&, 10, 10)
    'Show our new cursor
    X& = ShowCaret&(h&)
End Sub
Private Sub Text2_GotFocus()
    'retrieve the window which has the focus
    h& = GetFocus&()
    'Create a new cursor
    Call CreateCaret(h&, 0, 30, 30)
    'Show the new cursor
    X& = ShowCaret&(h&)
End Sub
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
KinGuyAuthor Commented:
Thank you for your comment ryancys, but can i stop it from blinking?
Guy
0
Ryan ChongCommented:
>>but can i stop it from blinking
Try look for the SetCaretBlinkTime API ?

Example:

Private Declare Function SetCaretBlinkTime Lib "user32" (ByVal wMSeconds As Long) As Long
Private Declare Function GetCaretBlinkTime Lib "user32" () As Long
Dim nOldBT As Long
Private Sub Form_Load()
    'KPD-Team 2000
    'URL: http://www.allapi.net/
    'E-Mail: KPDTeam@allapi.net
    'retrieve the current caret blinktime
    nOldBT = GetCaretBlinkTime
    'set the new caret blinktime
    SetCaretBlinkTime 1
    'When the form is loaded, open a text-editor and check out the caret blinktime
End Sub
Private Sub Form_Unload(Cancel As Integer)
    'restore the old caret blinktime
    SetCaretBlinkTime nOldBT
End Sub
0
Ashutosh VyasFounder, InitQubeCommented:
Try using the SelStart and SelLength properties of the textbox.
This highlights the text in the textbox.
Use these on your keydown events.

KeyCode = 39 for UP
Keycode = 37 for DOWN
0
KinGuyAuthor Commented:
Hi, i know i weren't here for a long time but army is army and you can't do nothing about it.
thank you all guys but i need to make a carret like dos. that blinks and that is horizontal. and it needs to be in a textbox.
can i do that?

Thanks,
KinGuy
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.