AnnHyperlinkMenu example for C++ Builder
//Global declarations
LEADRasterAnnotation * pRasterAnn= NULL;
LEADRasterAnnToolBar* pRasterAnnToolbar= NULL;
void __fastcall TForm1::Button1Click(TObject *Sender)
{
CoCreateInstance(CLSID_LEADRasterAnnotation, NULL, CLSCTX_ALL, IID_ILEADRasterAnnotation, (void**)&pRasterAnn);
CoCreateInstance(CLSID_LEADRasterAnnToolBar, NULL, CLSCTX_ALL, IID_ILEADRasterAnnToolBar, (void**)&pRasterAnnToolbar);
pRasterAnn->AnnParentRasterView = LEADRasterView1->Raster;
LEADEventSink1->Connect (pRasterAnn, DIID__LEADRasterAnnotationEvents);
pRasterAnn->AnnUserMode = ANN_USERMODE_DESIGN ;
}
void __fastcall TForm1::FormClose(TObject *Sender, TCloseAction &Action)
{
if (pRasterAnn)
pRasterAnn->Release ();
if (pRasterAnnToolbar)
pRasterAnnToolbar-> Release();
}
/*The AnnHyperLinkMenu event occurs whenever the user clicks on the Hyperlink menu item provided for automated annotations.
The menu item is enabled and disabled using AnnHyperlinkMenuEnable property.
The following is an example of AnnHyperlinkMenu event code, which includes a call to AnnSetHyperlinkMsg.*/
void __fastcall TForm1:: LEADEventSink1Invoke(TObject *Sender, int DispID,
const TGUID &IID, int LocaleID, WORD Flags, tagDISPPARAMS &Params,
Pointer varResult, Pointer ExcepInfo, Pointer ArgErr)
{
switch (DispID)
{
case LEADRASTERANNOTATIONEVENTS_ANNHYPERLINKMENU:
{
int hObject;
ILEADRasterVariant* pRasterVarObjects= NULL;
int nCount;
int x;
pRasterVarObjects= (ILEADRasterVariant*)(Params.rgvarg[1].pdispVal);
nCount= (OleVariant)(Params.rgvarg[0]);
/*set HyperLink to type ANNLINK_ANNEVENT5
and set the 5 params to some values.*/
for (x = 0; x < nCount; x ++ )
{
hObject= pRasterVarObjects->get_LongItemValue(x);
pRasterAnn->AnnSetHyperlinkMsg(hObject, ANN_LINK_ANNEVENT5, 5, 4, 3, 2, 1);
}
}
}
}