0

I have an C++ MFC CMenu based context menu object that has several menu items and one menu item is a popup menu (ie has a sub menu). Populating the sub menu is a time intensive process so I don't want to actually populate it until the user clicks on it.

How do I detect the display of the sub menu so I can only populate it when the user clicks on it?

I'm using TrackPopupMenu to display the menu to the user.

snowdude
  • 3,854
  • 1
  • 18
  • 27

2 Answers2

0

You can catch the WM_CONTEXTMENU message in the window. Then you can do whatever you like in response to that message.

Tommy Hui
  • 1,306
  • 6
  • 9
0

You want WM_INITMENUPOPUP.

Luke
  • 11,211
  • 2
  • 27
  • 38