My context menu extension contains a large number of sub items and I cannot know how many in QueryContextMenu so I add just the one dummy item to the sub menu (as suggested by the docs) and return 2 (parent menu item having sub menu+ sub menu item). I use WM_INITMENUPOPUP via IContextMenu::HandleMenuMsg2 to dynamically add the sub menu items, but I am confused as to what IDs to give them? If I give them the same IDs as the dummy menu item, how I can differentiate between the items? I am sure that the 'New' menu of Explorer somehow achieves this using some trick and I would like to know that trick :-) Any help would be appreciated Bob
Bob S wrote: > My context menu extension contains a large number of sub items and I > cannot know how many in QueryContextMenu so I add just the one dummy > item to the sub menu (as suggested by the docs) and return 2 (parent > menu item having sub menu+ sub menu item). I use WM_INITMENUPOPUP via > IContextMenu::HandleMenuMsg2 to dynamically add the sub menu items, > but I am confused as to what IDs to give them? If I give them the > same IDs as the dummy menu item, how I can differentiate between the > items? > > I am sure that the 'New' menu of Explorer somehow achieves this using > some trick and I would like to know that trick :-) I believe (it has been a while) the New menu reserves a block of ID's in the call to QueryContextMenu when it returns. In my opinion there is an upper bound of how many items should be in a context menu (i.e. not that many) so this is a feasible approach. JIm -- www.mustangpeak.net