I found the solution.
Since my contol is a shape using
CRgn
First I have to catch the
WM_RBUTTONUP
message this ensures that point is in the region. Then have to also handle
WM_CONTEXTMENU
event. Because if I don't the popup menu can appear in the wrong place on the screen.
With the genrated code
void CMyActiveXCtrl::OnContextMenu(CWnd* , CPoint )
{
}
I comment out the paramaters giving
void CMyActiveXCtrl::OnContextMenu(CWnd* pWnd, CPoint point)
{
}
Inside the body I inserted the following
myMenu.TrackPopupMenu(MY_ALIGNEMT_FLAGS,point.x, point.y,this);