AnnAutoSnapCursor example for Visual C++
// The following example toggles the automation cursor snap state.
// The cursor snap state affects whether the cursor snaps to a container border
// when creating annotations by clicking outside the annotation container.
void CAnnCOMView::ExampleAnnSetAutoSnapCursor()
{
int nRet = 0;
BOOL bSnap = FALSE;
CString strMsg;
bSnap = m_pltAnn->AnnAutoSnapCursor;
m_pltAnn->AnnAutoSnapCursor = !bSnap;
strMsg.Format(TEXT("Automation Snap Cursor State changed from %s to %s"),
!bSnap ? TEXT("TRUE") : TEXT("FALSE"),
m_pltAnn->AnnAutoSnapCursor ? TEXT("TRUE") : TEXT("FALSE"));
MessageBox(strMsg, TEXT("Notice"), MB_OK);
}