Find Code:
All Words
Any of the Words
Exact Phrase
Home
:
Code
:
Forums
:
Submit
:
Mailing List
:
About
:
Contact
Code
All
VB.NET
ASP.NET
C#
VB Classic
ASP Classic
Snippets
Popular
Resources
Submit Code
Forums
Articles
Tips
Links
Books
Contest
Link to us
Making your own caret. ...
Author:
Sachin Jalhotra
E-mail:
Click to e-mail author
Submitted:
10/20/2001
Version:
VB6
Compatibility:
VB6
Category:
Windows API
Views:
11245
Making your own caret.
Declarations:
'On form1 place a textbox (with a height for a couple of lines) and 1 picturebox. Set the tabindex property of TextBox to 0 'Select a bitmap for the picturebox and set the autosize on true. Now copy the below given code and run it
Code:
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() '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
Home
|
Forums
|
Submit
|
Books
|
Mailing List
|
Advertising
|
About
|
Contact
© 2024 A1VBCode. All rights reserved.
Legal disclaimer & terms of use
Privacy statement