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: Mon, 30 Jun 2008 02:17:51 -0700 (PDT),    group: microsoft.public.platformsdk.shell        back       


InvokeCommand (LPCMINVOKECOMMANDINFO lpcmi->verb) returns lesser value by 9   
Hello All,
I am facing a really strange issue. I have a context menu and a
submenu to this context menu added using InsertMenu method.
In my NSE, in the right view of explorer, if i do right click on an
item and select a submenu, the value returned by lpcmi->verb is
correct, but if i Do same thing on the left view on the same item, it
always returns a value less by 9 of cmd id.
I am using HI and LOWORD both.
uCmd=LOWORD(lpcmi->lpVerb);
Any help is highly appreciated.
Rgds,
Anu
date: Mon, 30 Jun 2008 02:17:51 -0700 (PDT)   author:   Anu

Re: InvokeCommand (LPCMINVOKECOMMANDINFO lpcmi->verb) returns lesser value by 9   
Anu wrote:
> I am facing a really strange issue. I have a context menu and a
> submenu to this context menu added using InsertMenu method.
> In my NSE, in the right view of explorer, if i do right click on an
> item and select a submenu, the value returned by lpcmi->verb is
> correct, but if i Do same thing on the left view on the same item, it
> always returns a value less by 9 of cmd id.

In each case, what is the value of the idCmdFirst parameter of QueryContextMenu?

-- 
Jim Barry, Microsoft MVP
date: Mon, 30 Jun 2008 10:44:38 +0100   author:   Jim Barry

Re: InvokeCommand (LPCMINVOKECOMMANDINFO lpcmi->verb) returns lesser value by 9   
On Jun 30, 2:44 pm, "Jim Barry"  wrote:
> Anu wrote:
> > I am facing a really strange issue. I have a context menu and a
> > submenu to this context menu added using InsertMenu method.
> > In my NSE, in the right view of explorer, if i do right click on an
> > item and select a submenu, the value returned by lpcmi->verb is
> > correct, but if i Do same thing on the left view on the same item, it
> > always returns a value less by 9 of cmd id.
>
> In each case, what is the value of the idCmdFirst parameter of QueryContextMenu?
>
> --
> Jim Barry, Microsoft MVP

Jim, thanks for the reply.

When clicked on LHS View - Value is 10
call stack is (the call to Querycontextmenu is not from application in
this case)
appsll::CShellVIew::Querycontextmenu(.....)
shdocvw.dll
appdll.ContextMenu::QueryInterface(....)

When clicked on RHS - value is 1 (as this is called from app, the
value is passed as 1, do I need to changes it?)
call stack is for this case is
--
hCtxMenu=::CreatePopupMenu();
pCtxtMenu->QueryContextMenu(hCtxMenu, 1, 1, 0x7FFF, CMF_EXPLORE); //
my app call explicitly..here the value passed as 1
appsll::CShellVIew: nContextMenu()
appsll::CShellVIew::WndProc(,,.....)

rgds,
anu
date: Tue, 1 Jul 2008 00:47:03 -0700 (PDT)   author:   Anu

Re: InvokeCommand (LPCMINVOKECOMMANDINFO lpcmi->verb) returns lesser value by 9   
On Jul 1, 12:47 pm, Anu  wrote:
> On Jun 30, 2:44 pm, "Jim Barry"  wrote:
>
> > Anu wrote:
> > > I am facing a really strange issue. I have a context menu and a
> > > submenu to this context menu added using InsertMenu method.
> > > In my NSE, in the right view of explorer, if i do right click on an
> > > item and select a submenu, the value returned by lpcmi->verb is
> > > correct, but if i Do same thing on the left view on the same item, it
> > > always returns a value less by 9 of cmd id.
>
> > In each case, what is the value of the idCmdFirst parameter of QueryContextMenu?
>
> > --
> > Jim Barry, Microsoft MVP
>
> Jim, thanks for the reply.
>
> When clicked on LHS View - Value is 10
> call stack is (the call to Querycontextmenu is not from application in
> this case)
> appsll::CShellVIew::Querycontextmenu(.....)
> shdocvw.dll
> appdll.ContextMenu::QueryInterface(....)
>
> When clicked on RHS - value is 1 (as this is called from app, the
> value is passed as 1, do I need to changes it?)
> call stack is for this case is
> --
> hCtxMenu=::CreatePopupMenu();
> pCtxtMenu->QueryContextMenu(hCtxMenu, 1, 1, 0x7FFF, CMF_EXPLORE); //
> my app call explicitly..here the value passed as 1
> appsll::CShellVIew: nContextMenu()
> appsll::CShellVIew::WndProc(,,.....)
>
> rgds,
> anu

i also changed the call and instead of 1, i am passing 10 now, in this
case value of idCmdFirst is 10 for both the cases and the difference
is still 0 for the LHS lpcmi->verb
date: Tue, 1 Jul 2008 01:05:07 -0700 (PDT)   author:   Anu

Re: InvokeCommand (LPCMINVOKECOMMANDINFO lpcmi->verb) returns lesser value by 9   
Anu wrote:
> When clicked on LHS View - Value is 10
[...]
> When clicked on RHS - value is 1 

The caller of QueryContextMenu can pass any values it likes for idCmdFirst and idCmdLast. This is necessary for creating composite menus. When the IContextMenu host calls InvokeCommand, it passes the menu ID offset (i.e. the actual ID minus idCmdFirst) so that everything works properly no matter what command ID range is used.

Raymond Chen wrote an in-depth series of articles about IContextMenu which you might find interesting:

http://blogs.msdn.com/oldnewthing/archive/2004/09/20/231739.aspx

-- 
Jim Barry, Microsoft MVP
date: Tue, 1 Jul 2008 11:32:49 +0100   author:   Jim Barry

Re: InvokeCommand (LPCMINVOKECOMMANDINFO lpcmi->verb) returns lesser value by 9   
Anu wrote:
> i also changed the call and instead of 1, i am passing 10 now

You cannot rely on idCmdFirst having any particular value. Do not try to match the value used by the "LHS" menu in your own QueryContextMenu call.

-- 
Jim Barry, Microsoft MVP
date: Tue, 1 Jul 2008 11:58:02 +0100   author:   Jim Barry

Google
 
Web ureader.com


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