AnnParentRasterView example for C++ 5.0 and later
For more information on declaration and unlocking procedures used in testing this example, refer to Annotation Declaration Information.
//This sample shows the minimal code to use the LEAD Annotation COM object
// m_LEADRasterView1 is a LEAD Raster View control
void CTutorDlg::OnButtonSample()
{
ILEADRasterAnnotation *pRasterAnn;
CoCreateInstance(
CLSID_LEADRasterAnnotation,
NULL,
CLSCTX_ALL,
IID_ILEADRasterAnnotation,
(void**)&pRasterAnn);
//Unlock the annotation support
//Note that L_KEY_DOCUMENT is a #define for the support key that you must supply
m_LEADRasterView1.GetRaster().UnlockSupport(L_SUPPORT_DOCUMENT, L_KEY_DOCUMENT);
//Attach the annotation object to the raster view control
IDispatch *pDispatch=NULL;
LPUNKNOWN pIUnknownNoRelease = m_LEADRasterView1.GetControlUnknown();
pIUnknownNoRelease->QueryInterface(IID_IDispatch, (void**)&pDispatch);
pRasterAnn->PutAnnParentRasterView(pDispatch);
if(pDispatch)
pDispatch->Release();
pRasterAnn->PutAnnAutoUpdate(TRUE);
//...
//... the rest of the program
//...
pRasterAnn->Release();
}