Compartilhar via


CreateCaret (Windows CE 5.0)

Send Feedback

This function creates a new shape for the system caret and assigns ownership of the caret to the specified window. The caret shape can be a line or a block.

BOOLCreateCaret(HWNDhWnd, HBITMAPhBitmap, intnWidth, intnHeight);

Parameters

  • hWnd
    [in] Handle to the window that owns the caret.
  • hBitmap
    [in] Unsupported; set to NULL. The default caret is solid.
  • nWidth
    [in] Integer that contains the width of the caret in logical units. If this parameter is zero, the width is set to the system-defined window border width.
  • nHeight
    [in] Integer that contains the height, in logical units, of the caret. If this parameter is zero, the height is set to the system-defined window border height.

Return Values

Nonzero indicates success. Zero indicates failure. To get extended error information, call GetLastError.

Remarks

The nWidth and nHeight parameters specify the caret's width and height, in logical units; the exact width and height, in pixels, depend on the window's mapping mode.

CreateCaret automatically destroys the previous caret shape, if any, regardless of the window that owns the caret. The caret is hidden until the application calls the ShowCaret function to make the caret visible.

The system provides one caret per queue. A window should create a caret only when it has the keyboard focus or is active. The window should destroy the caret before losing the keyboard focus or becoming inactive.

You can retrieve the width or height of the system's window border by using the ShowCaret function, specifying the SM_CXBORDER and SM_CYBORDER values. Using the window border width or height guarantees that the caret will be visible on a high-resolution screen.

Requirements

OS Versions: Windows CE 1.0 and later.
Header: Winuser.h.
Link Library: Caret.lib.

See Also

CreateBitmap | DestroyCaret | GetSystemMetrics | HideCaret | LoadBitmap | ShowCaret | Carets Functions

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.