AnnTextEdit example for Visual C++
// This example programmatically makes an annotation text object
//hObject go into edit mode
//Note that hObject must be a text-based annotation
void CAnnCOMView::OnExampleAnnTextEdit ()
{
int nRet = 0;
CString szError;
long hObject;
m_pltAnn->AnnCreate(ANN_OBJECT_TEXT, TRUE, TRUE);
hObject = m_pltAnn->GetAnnObject();
m_pltAnn->PutAnnRectLeft(hObject,0);
m_pltAnn->PutAnnRectTop(hObject,0);
m_pltAnn->PutAnnRectWidth(hObject,100);
m_pltAnn->PutAnnRectHeight(hObject,100);
nRet = m_pltAnn->AnnTextEdit(hObject);
switch(nRet)
{
case 0:
szError = "";
break;
case ERROR_AUTOMATION_INV_HANDLE:
szError = "AnnTextEdit failed because you are not in automated mode";
break;
case ERROR_INV_PARAMETER:
szError = "AnnTextEdit failed because hObject was not text-based";
break;
default:
szError = "AnnTextEdit failed";
break;
}
if (!szError.IsEmpty())
MessageBox(szError, TEXT("Error"), MB_OK);
}