snowdude
snowdude

Reputation: 3874

Delay population of a sub menu in Windows and C++

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.

Upvotes: 0

Views: 265

Answers (2)

Luke
Luke

Reputation: 11431

You want WM_INITMENUPOPUP.

Upvotes: 0

Tommy Hui
Tommy Hui

Reputation: 1336

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

Upvotes: 0

Related Questions