1.14.2 Sharing the Caret

There is only one caret, so only one caret shape can be active at a time. Applications must cooperatively share the caret to prevent undesired effects. Windows does not inform an application when a caret is created or destroyed, so to be cooperative a window should create, move, show, and hide a caret only when it has the input focus or is active. A window should destroy the caret before losing the input focus or becoming inactive.

Bitmaps for the caret can be created by using the CreateBitmap function, or loaded from the application's resources by using the LoadBitmap function. Bitmaps loaded from resources can be created by using the Image Editor and added to an application's resources by using the Resource Compiler.