I currently am attempting to do something simple:
CMenu menu;
menu.LoadMenu(IDR_MENU_IMAGE);
CPoint pt;
GetCursorPos(&pt);
menu.TrackPopupMenu(TPM_RIGHTBUTTON, pt.x, pt.y, this);
When I right-click, I get the below image. However, the menu is loaded; as I move my cursor down the menu, you can see it populate sub-menus just fine. It does this with any menu I load dynamically like this. I attempted to create a pointer (CMenu*) and still continue having this problem.
The points don't matter (I input arbitrary points).
The "this" in question is a derived CView* class. I am clicking on a HWND object but I tried to also take the CWnd::FromHandle() of this particular object I am clicking on and having the object handle it, but I still have the same problem.
My top menu structure and all other menus work - it is only in this particular case.
I don't really want to derive a C++ CMenu class just to override the MeasureItem function when the original menus should actually be working, and do work fine in other versions..
Help?

Use
GetSubMenu(0)to obtain a popup handle:Where
IDR_MENU_IMAGEis created in resource editor similar to the following:Result:
Note, this won't work if there is only a "menu bar", and no popup. The menu below cannot be created as popup:
You can also create the popup menu as follows: