The Caret (Not the Cursor)

When you type text into a program, generally a little underline, vertical bar, or box shows you where the next character you type will appear on the screen. You may know this as a “cursor,” but you’ll have to get out of that habit when programming for Windows. In Windows, it’s called the “caret.” The word “cursor” is reserved for the little bitmap image that represents the mouse position.

The Caret Functions

There are five essential caret functions:

  • CreateCaret Creates a caret associated with a window.

  • SetCaretPos Sets the position of the caret within the window.

  • ShowCaret Shows the caret.

  • HideCaret Hides the caret.

  • DestroyCaret Destroys the caret.

There are also functions to get the current caret position (GetCaretPos) and ...

Get Programming Windows®, Fifth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.