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, 08 Apr 2008 02:59:43 +0200,    group: microsoft.public.platformsdk.shell        back       


Detect selection of menu commands from "New" popup menu   
Hi,

I create a folder's background context menu using 
IShellFolder::CreateViewObject() and display it using 
TrackPopupMenuEx(). For the commands from the "New" popup menu, I want 
to do some special handling, so I need a way to tell whether the 
selected command is from this popup menu.
The command IDs aren't constant, so I thought about decrementing the 
command ID until I find a command with the verb "NewFolder". Since the 
"New" popup menu doesn't seem to use more than 3 IDs, I could keep the 
performance hit small and stop after 2 decrements.
Then I'd have the first command ID (ID_FIRST) used by the "New" popup 
menu. If the selected command's ID is >= ID_FIRST and <= (ID_FIRST + 2), 
the selected command would be from the "New" popup menu.
This even works on Windows XP (and probably also on 2003/Vista/2008). 
But on Windows 2000, the "NewFolder" command has no command verb. :-(

How else can I check whether the selected command is part of the "New" 
popup menu? I need this functionality in my Explorer replacement app to 
automatically enter label-edit mode for the newly created item.

Timo
-- 
www.TimoSoft-Software.de - Unicode controls for VB6
"Those who sacrifice freedom for safety deserve neither."
date: Tue, 08 Apr 2008 02:59:43 +0200   author:   Timo Kunze

Re: Detect selection of menu commands from "New" popup menu   
i can't think of any way you could reliable catch New menu command ids
if you go through the background menu, but if you manually create the
new menu object (D969A300-E7FF-11d0-A93B-00A0C90F2719) then you have
much more control. Sadly this is misbehaving in vista

btw nice to hear you are working on your own explorer replacement app!
After Jim Mustangpeak, now we only need Jim Barry to create his own,
then we'll all have one each :)

nikos
---
www.zabkat.com
date: Wed, 16 Apr 2008 04:46:28 -0700 (PDT)   author:   nikos

Re: Detect selection of menu commands from "New" popup menu   
I'm not sure this will work, but it might be worth a try:

If you implement an IShellView interface, you may be able to pass it to the 
context menu using IObjectWithSite, eg:

IShellView* pMyView;
IContextMenu* pMenu;
// ...
IObjectWithSite* pOWS;
if (SUCCEEDED(pMenu->QueryInterface(IID_IObjectWithSite, (void**)&pOWS)))
{
    pOWS->SetSite(pMyView);
    pOWS->Release();
}

Once the context menu has your IShellView, it should call 
IShellView::SelectItem with the SVSIF_EDIT flag set when it wants an item to 
go into rename mode.

At least I believe this is how Explorer does it :)

Cheers,
Jon

"Timo Kunze"  wrote in message 
news:%2380gWPRmIHA.4536@TK2MSFTNGP06.phx.gbl...
> Hi,
>
> I create a folder's background context menu using 
> IShellFolder::CreateViewObject() and display it using TrackPopupMenuEx(). 
> For the commands from the "New" popup menu, I want to do some special 
> handling, so I need a way to tell whether the selected command is from 
> this popup menu.
> The command IDs aren't constant, so I thought about decrementing the 
> command ID until I find a command with the verb "NewFolder". Since the 
> "New" popup menu doesn't seem to use more than 3 IDs, I could keep the 
> performance hit small and stop after 2 decrements.
> Then I'd have the first command ID (ID_FIRST) used by the "New" popup 
> menu. If the selected command's ID is >= ID_FIRST and <= (ID_FIRST + 2), 
> the selected command would be from the "New" popup menu.
> This even works on Windows XP (and probably also on 2003/Vista/2008). But 
> on Windows 2000, the "NewFolder" command has no command verb. :-(
>
> How else can I check whether the selected command is part of the "New" 
> popup menu? I need this functionality in my Explorer replacement app to 
> automatically enter label-edit mode for the newly created item.
>
> Timo
> -- 
> www.TimoSoft-Software.de - Unicode controls for VB6
> "Those who sacrifice freedom for safety deserve neither."
date: Wed, 16 Apr 2008 22:23:07 +1000   author:   Jon Potter am

Re: Detect selection of menu commands from "New" popup menu   
nikos wrote:
> btw nice to hear you are working on your own explorer replacement app!
> After Jim Mustangpeak, now we only need Jim Barry to create his own,
> then we'll all have one each :)

Unfortunately, I don't have anywhere near enough spare time for that! -- 
Jim Barry, Microsoft MVP
date: Wed, 16 Apr 2008 16:51:30 +0100   author:   Jim Barry

Re: Detect selection of menu commands from "New" popup menu   
nikos schrieb:
> i can't think of any way you could reliable catch New menu command ids
> if you go through the background menu, but if you manually create the
> new menu object (D969A300-E7FF-11d0-A93B-00A0C90F2719) then you have
> much more control. Sadly this is misbehaving in vista
Maybe this isn't really an issue. I've found a way to identify commands 
from the "New" menu for XP and above (okay, have not yet checked Vista). 
So I could create a new menu object on older systems and use the other 
method on newer systems.
What does my solution for XP and above look like? Well, I take the 
command id and decrease it until the command verb is "NewFolder". If the 
difference between the clicked command id and the id of the "NewFolder" 
command is 2 (or was it 3?) or less, then the command is part of the new 
menu.
I'm not sure this approach is really reliable. While on my XP and 2003 
systems the menu items below the separator all have the same ID, I'm not 
sure this is guaranteed.

> btw nice to hear you are working on your own explorer replacement app!
> After Jim Mustangpeak, now we only need Jim Barry to create his own,
> then we'll all have one each :)
Well, actually this code is for a new ActiveX component.
But last year I've also worked on a clone of XP's Explorer that can be 
used on Vista (I will probably switch to Vista soon and the new Explorer 
drives me nuts). I stopped working on this project when I ran into too 
many problems with thumbnails/UAC shield overlays Vista (maybe I'm just 
too much trying to be perfect *g*). Either I'll revive it or I'll start 
using xplorer² when I switch to Vista.

Bye
Timo
-- 
www.TimoSoft-Software.de - Unicode controls for VB6
"Those who sacrifice freedom for safety deserve neither."
date: Wed, 16 Apr 2008 20:01:38 +0200   author:   Timo Kunze

Re: Detect selection of menu commands from "New" popup menu   
Hi Jon,

I already had the same idea. It didn't work (none of my IShellView 
methods was ever called). But I didn't call SetSite and maybe this was 
the problem. I'll try again.

Many thanks
Timo
-- 
www.TimoSoft-Software.de - Unicode controls for VB6
"Those who sacrifice freedom for safety deserve neither."
date: Wed, 16 Apr 2008 20:04:45 +0200   author:   Timo Kunze

Re: Detect selection of menu commands from "New" popup menu   
Timo Kunze schrieb:
 > But I didn't call SetSite and maybe this was
> the problem.
I noticed in context this sounds a bit odd. *g* I implemented 
IShellBrowser (QueryActiveShellView) and IShellView and also handled the 
message WM_GETISHELLBROWSER. None of these was ever called.

I've just tried the IObjectWithSite approach. Unfortunately none of my 
IShellView implementations is ever called.

Thanks anyway
Timo
-- 
www.TimoSoft-Software.de - Unicode controls for VB6
"Those who sacrifice freedom for safety deserve neither."
date: Wed, 16 Apr 2008 22:52:18 +0200   author:   Timo Kunze

Re: Detect selection of menu commands from "New" popup menu   
> btw nice to hear you are working on your own explorer replacement app!
> After Jim Mustangpeak, now we only need Jim Barry to create his own,
> then we'll all have one each :)

<grin>

Jim
-- 
www.mustangpeak.net
date: Wed, 16 Apr 2008 18:46:33 -0700   author:   Jim

Google
 
Web ureader.com


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