Home  |  About  |   Search   

What's New
Table Of Contents
Credits
Netiquette
10 Commandments 
Bugs
Tables
Queries
Forms
Reports
Modules
APIs
Strings
Date/Time
General
Downloads
Resources
Search
Feedback
mvps.org

RunCommand Constants

Terms of Use


 

API: Change cursor while editing

Author(s)
Dev Ashish

(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.

'********* Code Start ********
' This code was originally written by Dev Ashish.
' It is not to be altered or distributed,
' except as part of an application.
' You are free to use it in any application,
' provided the copyright notice is left unchanged.
'
' Code Courtesy of
' Dev Ashish
'
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
'************ Code End **********

1998-2009, Dev Ashish & Arvin Meyer, All rights reserved. Optimized for Microsoft Internet Explorer