Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
platform
active.directory
adsi
adsi.iis-admin
base
com_ole
complus_mts
component_svcs
database
directx
gdi
graphics_mm
internet.client
internet.server
internet.server.isapi-dev
localization
mapi
messaging
msi
mslayerforunicode
multimedia
networking
networking.ipv6
sdk_install
security
shell
telephony.tapi_2
telephony.tapi_3
telephony.tsp
telephony.wte
tools
ui
ui_shell
win_base_svcs
win16
  
 
date: Tue, 19 Feb 2008 11:10:29 +0530,    group: microsoft.public.platformsdk.shell        back       


Dynamic submenu in context menu extension   
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
date: Tue, 19 Feb 2008 11:10:29 +0530   author:   Bob S

Re: Dynamic submenu in context menu extension   
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
date: Wed, 20 Feb 2008 04:39:23 -0800   author:   Jim

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us