Export (0) Print
Expand All
MFC
Expand Minimize
This topic has not yet been rated - Rate this topic

CWnd::CreateCaret 

Creates a new shape for the system caret and claims ownership of the caret.


void CreateCaret(
   CBitmap* pBitmap 
);

Parameters

pBitmap

Identifies the bitmap that defines the caret shape.

The bitmap must have previously been created by the CBitmap::CreateBitmap member function, the CreateDIBitmap Windows function, or the CBitmap::LoadBitmap member function.

CreateCaret automatically destroys the previous caret shape, if any, regardless of which window owns the caret. Once created, the caret is initially hidden. To show the caret, the ShowCaret member function must be called.

The system caret is a shared resource. CWnd should create a caret only when it has the input focus or is active. It should destroy the caret before it loses the input focus or becomes inactive.

// Changes the caret of the edit control in this dialog box
void CMyDlg::OnChangeCaret() 
{
   CBitmap* pBitmap = new CBitmap;
   pBitmap->LoadBitmap(IDB_HAPPY_BITMAP);
   m_editCtrl.CreateCaret(pBitmap);
   m_editCtrl.ShowCaret();
}
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.