This message is sent when the user clicks on a menu item in the user defined pop-up menu. This menu can be created by the AnnoCreateCustomMenu and AnnoAddCustomMenuItem functions. You can display the created custom menu with the AnnoUIOnRButtonDownExt function. This function gets a window handle as a parameter. This window retrieves the message from the BiAnno.dll and contains information about the menu item clicked on by the user.
For example:
#define ANNOTATION_MESSAGE_NAME _T("Annotation_Window_Message")
// register the window message
m_iAnnoMsg = RegisterWindowMessage(ANNOTATION_MESSAGE_NAME);
//…
typedef struct tag_ANNOTATION_MESSAGE
{
int iObjType;
DWORD dwRet;
}ANNOTATION_MESSAGE, *LPANNOTATION_MESSAGE;
//…
// Handling the message
LRESULT CMainFrame::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{
if (message == m_iAnnoMsg)
{
LPANNOTATION_MESSAGE pParam =
(LPANNOTATION_MESSAGE)lParam;
if (pParam->dwRet != 0)
{
CString szMsg;
szMsg.Format("Return Value: %d\nObject Type: %d",
pParam->dwRet, pParam->iObjType);
AfxMessageBox(szMsg, MB_ICONINFORMATION);
}
}
return CWnd::WindowProc(message, wParam, lParam);
}
If the pParam->dwRet is zero, the user didn’t select any menu item from the displayed pop-up menu. The iObjType is the type of the selected annotation object. If no annotation object selected the iObjectType is -1. The dwRet is the ID of the selected menu item. This value can be specified with AnnoAddCustomMenuItem and AnnoSetMenuItemReturnValue functions.