AnnHyperlink example for C++ 5.0 and later
For details on event handling of the COM objects in MFC, and m_pDlg and m_pRasterAnn declarations, refer to the "Creating and Using Annotations (C++ 5.0 and later) Tutorial"
//AnnHyperlink event gets fired when the user clicks on a button or hotspot in run mode
//Prior to this event, you should call AnnSetHyperlinkMsg (see example for AnnSetHyperlinkMsg)
//For details on event handling of the COM objects in MFC,
// and m_pDlg and m_pRasterAnn delcarations, refer to
// the "Creating and Using Annotations (C++ 5.0 and later) Tutorial"
void CRasterAnnSink::OnAnnHyperlink(long hObject, short iParamCount, long lParam1, long lParam2, long lParam3, long lParam4, long lParam5)
{
CString strMsg;
CString strTmp;
short nType;
m_pDlg->m_pRasterAnn->AnnGetHyperlinkType(hObject);
nType = m_pDlg->m_pRasterAnn->AnnHyperlinkType();
if ((nType == ANN_LINK_ANNEVENT5) || (nType == ANN_LINK_ANNEVENT))
{
if (iParamCount >= 0)
{
strMsg.Format(TEXT("%d params are valid\n"), iParamCount);
}
if (iParamCount >= 1)
{
strTmp = strMsg;
strMsg.Format(TEXT("%s Param1: %d\n"), strTmp, lParam1);
}
if (iParamCount >= 2)
{
strTmp = strMsg;
strMsg.Format(TEXT("%s Param2: %d\n"), strTmp, lParam2);
}
if (iParamCount >= 3)
{
strTmp = strMsg;
strMsg.Format(TEXT("%s Param3: %d\n"), strTmp, lParam3);
}
if (iParamCount >= 4)
{
strTmp = strMsg;
strMsg.Format(TEXT("%s Param4: %d\n"), strTmp, lParam4);
}
if (iParamCount >= 5)
{
strTmp = strMsg;
strMsg.Format(TEXT("%s Param5: %d\n"), strTmp, lParam5);
}
}
else
{
strMsg.Format(TEXT("Invalid Type"));
}
AfxMessageBox(strMsg);
}