0

I have items that I want to go into a context menu. The problem is that the items take a while to generate. Therefore, if I have to prepopulate the context menu, i have to populate all 1500 items which takes a while even if those submenu's arent accessed. Therefore, I am looking for a way to populate the menu only if it is actually opened. Does anyone know how to do this?

chacham15
  • 13,719
  • 26
  • 104
  • 207
  • 2
    You must be kidding? A context menu with 1500 items? You may want to rethink your GUI design before your users flagrantly attack you. – AJG85 Apr 30 '12 at 22:13
  • @AJG85 1500 is the design spec maximum. The average expected is supposed to be about 5. Those 5 though each take about 0.2 seconds to load (because they are the result of a status check on a remote server) so I still need the load on demand. – chacham15 Apr 30 '12 at 22:18
  • I've seen similar context menus, sometimes there's just no way out.. I would suggest to start a helper thread which initializes the menu items. If the context menu is accessed and the menu is not loaded yet the user will just have to wait. – demorge Apr 30 '12 at 22:22

1 Answers1

0

The IContextMenu2 interface sends a WM_INITMENUPOPUP message which allows you to fill in items right before the menu is about to pop up.

chacham15
  • 13,719
  • 26
  • 104
  • 207