[Overview][Types][Procedures and functions][Variables][Index] | Reference for unit 'LCLIntf' (#lcl)

# CreateCaret

Creates the Caret (text cursor) for the specified windowed control.

## Declaration

Source position: winapih.inc line 51

`function CreateCaret(`
`Handle: HWND;`
`Bitmap: HBITMAP;`
`width: Integer;`
`Height: Integer`
`):Boolean;`

## Arguments

`Handle` |  | The handle for the windowed control that owns the caret.
`Bitmap` |  | The handle for the Bitmap with the caret shape, 0 for a solid (black) caret, or 1 for a gray caret.
`width` |  | The width of the caret.
`Height` |  | The height of the caret.

## Function result

False on failure.

## Description

CreateCaret is a Boolean function used to created the caret (or text cursor) displayed on a control when editing is active. CreateCaret calls the corresponding routine in the widgetset class to initialize the cursor with a given size, or a shape loaded from a bitmap image.

Handle is the HWND value representing the handle for the windowed control which owns and implements the caret.

Bitmap is the HBITMAP value with the handle for the bitmap image used as the caret shape. When Bitmap is set to 0, a handle is not available for the caret shape. When Bitmap is assigned, the values in the Height and Width arguments are ignored; the dimensions are determined by the bitmap image.

The Windows platform attaches special meanings to the values 0 and 1 in the Bitmap handle. 0 causes a solid black block with the dimensions in Height and Width to be used as the caret shape. 1 causes a solid gray block with the dimensions in Height and Width to be used as the caret shape.

## See also

DestroyCaret |  | Destroys the caret but does not free the bitmap.
ShowCaret |  | Shows the Caret (text cursor).
HideCaret |  | Removes the caret from the screen.
SetCaretPos |  | Moves the Caret to the specified coordinates.
SetCaretPosEx |  | Moves the Caret into a window.