AnnHyperlink 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();
}
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_ANNHYPERLINK:
{
int hObject= (OleVariant)(Params.rgvarg[6]);
int iParamCount= (OleVariant)(Params.rgvarg[5]);
int lParam1= (OleVariant)(Params.rgvarg[4]);
int lParam2= (OleVariant)(Params.rgvarg[3]);
int lParam3= (OleVariant)(Params.rgvarg[2]);
int lParam4= (OleVariant)(Params.rgvarg[1]);
int lParam5= (OleVariant)(Params.rgvarg[0]);
AnsiString msgstr;
short nType;
pRasterAnn->AnnGetHyperlinkType (hObject);
nType= pRasterAnn->AnnHyperlinkType;
if ((nType == ANN_LINK_ANNEVENT5) || (nType == ANN_LINK_ANNEVENT))
{
if (iParamCount >= 0)
msgstr = IntToStr(iParamCount) + " params are valid\n";
if (iParamCount >= 1)
msgstr = msgstr + "Param1: " + IntToStr(lParam1) + "\n";
if (iParamCount >= 2)
msgstr = msgstr + "Param2: " + IntToStr(lParam2) + "\n";
if (iParamCount >= 3)
msgstr = msgstr + "Param3: " + IntToStr(lParam3) + "\n";
if (iParamCount >= 4)
msgstr = msgstr + "Param4: " + IntToStr(lParam4) + "\n";
if (iParamCount == 5)
msgstr = msgstr + "Param5: " + IntToStr(lParam5) + "\n";
}
else
msgstr = "Invalid Type";
ShowMessage (msgstr);
}
}
}