Results 1 to 3 of 3

Thread: Blinking Cursor.

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Apr 2000
    Posts
    215
    Hiyas,

    I was just wondering if anyone could tell me how to set the position of the blinking cursor? u know the one that is constantly blinking when its in a text box, because I am modifinying contents on a text box of another window, but it makes the blinking cursor go to the start of the text box, and I want the user to be able to keep typing sort of thing. anyone know how to do this on another window?

    thanx for any help.

  2. #2
    Fanatic Member Mad Compie's Avatar
    Join Date
    Aug 2000
    Location
    Kuurne (Belgium)
    Posts
    553
    Code:
    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()
     '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

  3. #3
    Fanatic Member Mad Compie's Avatar
    Join Date
    Aug 2000
    Location
    Kuurne (Belgium)
    Posts
    553

    Wink

    Yet another extract from the KPD QPI guide, which really explains that you also have to use ShowCaret():

    Code:
    '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: [email protected]
        
        '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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width