home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 1_2002.ISO / Data / Zips / ProjectX1_562922192002.psc / ModulesCode / modCodeX6.bas < prev    next >
Encoding:
BASIC Source File  |  1997-02-19  |  953 b   |  27 lines

  1. Attribute VB_Name = "modCodeX6"
  2. Private Declare Function CreateCaret Lib "user32" (ByVal hwnd As Long, ByVal hBitmap As Long, ByVal nWidth As Long, ByVal nHeight As Long) As Long
  3. Private Declare Function ShowCaret Lib "user32" (ByVal hwnd As Long) As Long
  4. Private Declare Function GetFocus Lib "user32" () As Long
  5.  
  6. Public Sub FocusOnTextChar(TextB As TextBox)
  7. '-----------------------------------
  8. '-    FocusOnTextChar()
  9. '-
  10. '- It'll set a custom 'pointer'
  11. '-
  12. '-     By T-Virus Creations
  13. '- http://www.tvirusonline.be
  14. '- email: tvirus4ever@yahoo.co.uk
  15. '-
  16. '-----------------------------------
  17.     Dim h As Long
  18.     'sets/retrieves the window which has the focus
  19.     TextB.SetFocus
  20.     h = GetFocus()
  21.     'Create a new cursor
  22.     'Call CreateCaret(H&, 0, 5, 15) ' Use this for constant size
  23.     Call CreateCaret(h&, 0, 5, TextB.FontSize * 2) ' Isn't 100% good but it works
  24.     'Show the new cursor
  25.     X& = ShowCaret&(h&)
  26. End Sub
  27.