VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



CREATE YOUR OWN CARET WITH CUSTOM DESIGN TO SHOW IN THE TEXT-BOXES FOR YOUR APPLICATION

by Dipen Anovadia (19 Submissions)
Category: Windows System Services
Compatability: Visual Basic 5.0
Difficulty: Unknown Difficulty
Originally Published: Sat 15th April 2006
Date Added: Mon 8th February 2021
Rating: (1 Votes)

CREATE YOUR OWN CARET WITH CUSTOM DESIGN TO SHOW IN THE TEXT-BOXES FOR YOUR APPLICATION

API Declarations


Public Declare Function CreateCaret Lib "user32.dll" (ByVal hwnd As Long, ByVal hBitmap As Long, ByVal nWidth As Long, ByVal nHeight As Long) As Long

'Displays the caret
Public Declare Function ShowCaret Lib "user32.dll" (ByVal hwnd As Long) As Long

'Destroys the caret
Public Declare Function DestroyCaret Lib "user32.dll" () As Long


Rate CREATE YOUR OWN CARET WITH CUSTOM DESIGN TO SHOW IN THE TEXT-BOXES FOR YOUR APPLICATION



' TextBox - Text1
' CommandButton - Command1

Private Sub Command1_Click()

    Dim lRet As Long

    'We set focus to let 'DestoryCaret' know about which caret to destory
    Text1.SetFocus
    Call DestroyCaret 'Destroys the old caret

    'Creates a new caret for Text1 with size 8*12
    'The argument 0& is for settings a picture as a caret.
    'For settings picture in caret, load it in variable and then
    'pass it in argument.
    lRet = CreateCaret(Text1.hwnd, 0&, 8&, 12&)

    'Just to know the return value
    Caption = lRet

    'Without 'ShowCaret' the new caret is not displayed, so use it now
    Call ShowCaret(Text1.hwnd)
End Sub
'Errors, feedbacks, etc...
'MAIL: [email protected]

Download this snippet    Add to My Saved Code

CREATE YOUR OWN CARET WITH CUSTOM DESIGN TO SHOW IN THE TEXT-BOXES FOR YOUR APPLICATION Comments

No comments have been posted about CREATE YOUR OWN CARET WITH CUSTOM DESIGN TO SHOW IN THE TEXT-BOXES FOR YOUR APPLICATION. Why not be the first to post a comment about CREATE YOUR OWN CARET WITH CUSTOM DESIGN TO SHOW IN THE TEXT-BOXES FOR YOUR APPLICATION.

Post your comment

Subject:
Message:
0/1000 characters