How to Change the Size of the Text Cursor in a Text BoxLast reviewed: June 21, 1995Article ID: Q94318 |
The information in this article applies to:
- Microsoft Visual Basic programming system for Windows, versions 1.0, 2.0, and 3.0
SUMMARYAlthough there is no property that will allow you to change the appearance of the text cursor (text caret) in a Visual Basic text box, you can use the Windows API call CreateCaret() function to do so.
MORE INFORMATION
API CallsIn the example below, API calls change the size of the text cursor. The CreateCaret() function creates a new shape for the system caret and assigns ownership of the caret to the given window. The caret shape can be a line, block, or bitmap. Here's the syntax:
Void CreateCaret(hwnd, hbmp,nwidth,nheight) HWND hwnd - handle of owner window HBITMAP hbmp - handle of bitmap for caret shape int nwidth - caret width int nheight - caret heightThe ShowCaret() function shows the caret on the screen at the caret's current position. Once shown, the caret begins flashing automatically.
Void ShowCaret(hwnd) HWND hwnd - handle of window with caretThe GetFocus() function retrieves the handle of the window that currently has the input focus.
HWND GetFocus(void) Example CodeTo see these API calls in action do the following:
|
Additional reference words: 1.00 2.00 3.00
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |