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: Wed, 26 Mar 2008 11:25:52 -0700 (PDT),    group: microsoft.public.platformsdk.shell        back       


Proper explorer context menu   
I am not writing a shell extension, rather a separate program that
querys for the explorer context menu. I am able to get the shell
folder of the directory I want ot query. I use an IShellFolder to
represent the folder. When I use it to get the desktop, I have the
option of getting the IShellFolder of C:\Documents And Settings
\Mastadex\Desktop or the Virtual folder that represents the desktop.

Both of these menus are completely different. One has a "New" submenu
on it and the other doesn't. The second menu has a properties menu
item that launches the display settings, the first one doesn't.

Is there an easy way of merging the two menus so that I can get both
"New" and the properties menu item that launches the Display Settings.

Here is how I am getting at the menu as if I was trying to get :

Code Snippet

HMENU getMenu(IShellFolder *sh)
{
LPCONTEXTMENU icm1 = NULL, contextMenu = NULL;
HMENU menu = NULL;

shellFolder->CreateViewObject(NULL, IID_IContextMenu,(void**) &icm1);

if (icm1)
{
icm1->QueryInterface(IID_IContextMenu3, contextMenu);
contextMenu->QueryContextMenu(menu, 0, 1, 10000, CMF_NORMAL |
CMF_EXTENDEDVERBS | CMF_EXPLORE);

return menu;
}
return NULL;
}

Basically, the above approach gives me a menu that has the "New"
submenu in it. If I hange the CreateViewObject() function call into
the bottom example, it will NOT give me the "New" submenu, rather
everything else (Paste, Paste Shotcut, Properties that launch the
display settings) that I would assume you would get as if right
clicked on the desktop.

Code Snippet

HMENU getMenu(IShellFolder *sh, LPITEMIDLIST *pidlArray, int numPidls)
{
LPCONTEXTMENU icm1 = NULL, contextMenu = NULL;
HMENU menu = NULL;

shellFolder->GetUIObjectOf(NULL, numItems, (LPCITEMIDLIST *)
pidlArray, IID_IContextMenu, NULL,(void**) &icm1);

if (icm1)
{
icm1->QueryInterface(IID_IContextMenu3, ppContextMenu);
contextMenu->QueryContextMenu(menu, 0, 1, 10000, CMF_NORMAL |
CMF_EXTENDEDVERBS | CMF_EXPLORE);

return menu
}
}

Is there a way to merge the two LPCONTEXTMENU structures so that I can
get all the options form both menus in one menu. I tried manually
moving each item in the HMENU structures into one HMENU, but the
funcitonallity of the menu (when invoked) did not do anything.

I am basing my menu off of this example:
http://www.codeproject.com/KB/shell/shellcontextmenu.aspx
date: Wed, 26 Mar 2008 11:25:52 -0700 (PDT)   author:   CodeBot

Re: Proper explorer context menu   
Hmmm, I don't understand. You are using Explorer interfaces to get the same 
menu as Explorer. But yet you don't want the menu for the Desktop virtual 
folder nor for a file system folder? I don't think you want to try to merge 
menus that are intended to be separate. And what are you going to do with 
this menu?

Paul

"CodeBot"  wrote in message 
news:4821fbdd-e57c-4be1-8eff-e6b8f0a1d7f5@s19g2000prg.googlegroups.com...
>I am not writing a shell extension, rather a separate program that
> querys for the explorer context menu. I am able to get the shell
> folder of the directory I want ot query. I use an IShellFolder to
> represent the folder. When I use it to get the desktop, I have the
> option of getting the IShellFolder of C:\Documents And Settings
> \Mastadex\Desktop or the Virtual folder that represents the desktop.
>
> Both of these menus are completely different. One has a "New" submenu
> on it and the other doesn't. The second menu has a properties menu
> item that launches the display settings, the first one doesn't.
>
> Is there an easy way of merging the two menus so that I can get both
> "New" and the properties menu item that launches the Display Settings.
>
> Here is how I am getting at the menu as if I was trying to get :
>
> Code Snippet
>
> HMENU getMenu(IShellFolder *sh)
> {
> LPCONTEXTMENU icm1 = NULL, contextMenu = NULL;
> HMENU menu = NULL;
>
> shellFolder->CreateViewObject(NULL, IID_IContextMenu,(void**) &icm1);
>
> if (icm1)
> {
> icm1->QueryInterface(IID_IContextMenu3, contextMenu);
> contextMenu->QueryContextMenu(menu, 0, 1, 10000, CMF_NORMAL |
> CMF_EXTENDEDVERBS | CMF_EXPLORE);
>
> return menu;
> }
> return NULL;
> }
>
> Basically, the above approach gives me a menu that has the "New"
> submenu in it. If I hange the CreateViewObject() function call into
> the bottom example, it will NOT give me the "New" submenu, rather
> everything else (Paste, Paste Shotcut, Properties that launch the
> display settings) that I would assume you would get as if right
> clicked on the desktop.
>
> Code Snippet
>
> HMENU getMenu(IShellFolder *sh, LPITEMIDLIST *pidlArray, int numPidls)
> {
> LPCONTEXTMENU icm1 = NULL, contextMenu = NULL;
> HMENU menu = NULL;
>
> shellFolder->GetUIObjectOf(NULL, numItems, (LPCITEMIDLIST *)
> pidlArray, IID_IContextMenu, NULL,(void**) &icm1);
>
> if (icm1)
> {
> icm1->QueryInterface(IID_IContextMenu3, ppContextMenu);
> contextMenu->QueryContextMenu(menu, 0, 1, 10000, CMF_NORMAL |
> CMF_EXTENDEDVERBS | CMF_EXPLORE);
>
> return menu
> }
> }
>
> Is there a way to merge the two LPCONTEXTMENU structures so that I can
> get all the options form both menus in one menu. I tried manually
> moving each item in the HMENU structures into one HMENU, but the
> funcitonallity of the menu (when invoked) did not do anything.
>
> I am basing my menu off of this example:
> http://www.codeproject.com/KB/shell/shellcontextmenu.aspx
date: Wed, 26 Mar 2008 15:07:09 -0400   author:   Paul Baker [MVP, Windows - SDK] am

Re: Proper explorer context menu   
On Mar 26, 3:07 pm, "Paul Baker [MVP, Windows - SDK]"
<paulrichardba...@community.nospam> wrote:
> Hmmm, I don't understand. You are using Explorer interfaces to get the same
> menu as Explorer. But yet you don't want the menu for the Desktop virtual
> folder nor for a file system folder? I don't think you want to try to merge
> menus that are intended to be separate. And what are you going to do with
> this menu?
>
> Paul
>
> "CodeBot"  wrote in message
>
> news:4821fbdd-e57c-4be1-8eff-e6b8f0a1d7f5@s19g2000prg.googlegroups.com...
>
> >I am not writing a shell extension, rather a separate program that
> > querys for the explorer context menu. I am able to get the shell
> > folder of the directory I want ot query. I use an IShellFolder to
> > represent the folder. When I use it to get the desktop, I have the
> > option of getting the IShellFolder of C:\Documents And Settings
> > \Mastadex\Desktop or the Virtual folder that represents the desktop.
>
> > Both of these menus are completely different. One has a "New" submenu
> > on it and the other doesn't. The second menu has a properties menu
> > item that launches the display settings, the first one doesn't.
>
> > Is there an easy way of merging the two menus so that I can get both
> > "New" and the properties menu item that launches the Display Settings.
>
> > Here is how I am getting at the menu as if I was trying to get :
>
> > Code Snippet
>
> > HMENU getMenu(IShellFolder *sh)
> > {
> > LPCONTEXTMENU icm1 = NULL, contextMenu = NULL;
> > HMENU menu = NULL;
>
> > shellFolder->CreateViewObject(NULL, IID_IContextMenu,(void**) &icm1);
>
> > if (icm1)
> > {
> > icm1->QueryInterface(IID_IContextMenu3, contextMenu);
> > contextMenu->QueryContextMenu(menu, 0, 1, 10000, CMF_NORMAL |
> > CMF_EXTENDEDVERBS | CMF_EXPLORE);
>
> > return menu;
> > }
> > return NULL;
> > }
>
> > Basically, the above approach gives me a menu that has the "New"
> > submenu in it. If I hange the CreateViewObject() function call into
> > the bottom example, it will NOT give me the "New" submenu, rather
> > everything else (Paste, Paste Shotcut, Properties that launch the
> > display settings) that I would assume you would get as if right
> > clicked on the desktop.
>
> > Code Snippet
>
> > HMENU getMenu(IShellFolder *sh, LPITEMIDLIST *pidlArray, int numPidls)
> > {
> > LPCONTEXTMENU icm1 = NULL, contextMenu = NULL;
> > HMENU menu = NULL;
>
> > shellFolder->GetUIObjectOf(NULL, numItems, (LPCITEMIDLIST *)
> > pidlArray, IID_IContextMenu, NULL,(void**) &icm1);
>
> > if (icm1)
> > {
> > icm1->QueryInterface(IID_IContextMenu3, ppContextMenu);
> > contextMenu->QueryContextMenu(menu, 0, 1, 10000, CMF_NORMAL |
> > CMF_EXTENDEDVERBS | CMF_EXPLORE);
>
> > return menu
> > }
> > }
>
> > Is there a way to merge the two LPCONTEXTMENU structures so that I can
> > get all the options form both menus in one menu. I tried manually
> > moving each item in the HMENU structures into one HMENU, but the
> > funcitonallity of the menu (when invoked) did not do anything.
>
> > I am basing my menu off of this example:
> >http://www.codeproject.com/KB/shell/shellcontextmenu.aspx

The reason I dont want either menu is because neither have the full
functionality I am looking for. Hence I am trying to merge it. I am
curently useing the menu for the folder because it has the New
submenu. But it doesnt have Paste, or the properties the launches
display properties. I can modify each menu separately, but I dont have
the invoke command for those menu items that I manually add. If it is
not possible to merge the menus, is it possible to invoke some
function that would emulate the "New" submenu? I knwo the values for
each entry are somewhere in the registry.
date: Wed, 26 Mar 2008 17:54:05 -0700 (PDT)   author:   CodeBot

Re: Proper explorer context menu   
CodeBot wrote:
> The reason I dont want either menu is because neither have the full
> functionality I am looking for. Hence I am trying to merge it. I am
> curently useing the menu for the folder because it has the New
> submenu. But it doesnt have Paste, or the properties the launches
> display properties. I can modify each menu separately, but I dont have
> the invoke command for those menu items that I manually add. If it is
> not possible to merge the menus, is it possible to invoke some
> function that would emulate the "New" submenu? 

Raymond Chen wrote a series of articles about hosting context menus, including how to create composite menus:

http://blogs.msdn.com/oldnewthing/archive/2004/10/06/238630.aspx
http://blogs.msdn.com/oldnewthing/archive/2004/10/07/239197.aspx

The "New" menu is available separately: 

http://msdn2.microsoft.com/en-us/library/bb774110.aspx

By the way, the desktop background menu is a composite menu containing the DefView's background menu ("Arrange Icons By", "Refresh", "Paste", and "Paste Shortcut") and the desktop folder's menu ("New" and "Properties").

Note that Vista includes a "New -> Folder" item on the context menu for filesystem folders, but only when it is displayed in the navigation pane.

-- 
Jim Barry, Microsoft MVP
date: Thu, 27 Mar 2008 14:49:41 -0000   author:   Jim Barry

Re: Proper explorer context menu   
On Mar 27, 10:49 am, "Jim Barry"  wrote:
> CodeBot wrote:
> > The reason I dont want either menu is because neither have the full
> > functionality I am looking for. Hence I am trying to merge it. I am
> > curently useing the menu for the folder because it has the New
> > submenu. But it doesnt have Paste, or the properties the launches
> > display properties. I can modify each menu separately, but I dont have
> > the invoke command for those menu items that I manually add. If it is
> > not possible to merge the menus, is it possible to invoke some
> > function that would emulate the "New" submenu?
>
> Raymond Chen wrote a series of articles about hosting context menus, including how to create composite menus:
>
> http://blogs.msdn.com/oldnewthing/archive/2004/10/06/238630.aspxhttp://blogs.msdn.com/oldnewthing/archive/2004/10/07/239197.aspx
>
> The "New" menu is available separately:
>
> http://msdn2.microsoft.com/en-us/library/bb774110.aspx
>
> By the way, the desktop background menu is a composite menu containing the DefView's background menu ("Arrange Icons By", "Refresh", "Paste", and "Paste Shortcut") and the desktop folder's menu ("New" and "Properties").
>
> Note that Vista includes a "New -> Folder" item on the context menu for filesystem folders, but only when it is displayed in the navigation pane.
>
> --
> Jim Barry, Microsoft MVP

Thanks for the insight Jim,

What I have currently is just the New submenu showing up. I have two
LPCONTEXTMENU variables, one that shows up the new submenu, and the
other shows the regular desktop menu (minus the new submenu). I am
using the following code to get the new submenu:

	CoCreateInstance(CLSID_NewMenu, NULL, CLSCTX_ALL, IID_IShellExtInit,
(void **) &psfShellExt);
	psfShellExt->Initialize((LPCITEMIDLIST) psfFolder, NULL, NULL);
	psfShellExt->QueryInterface(IID_IContextMenu3, (void **) &lpcm);

How would I go about putting them together into something that
resembles a full context menu? Also, how would rendering be handled
since I am calling IContextMenu::HandleMenuMsg() for just one of the
items.

Thanks for the help so far :)
date: Mon, 31 Mar 2008 09:34:29 -0700 (PDT)   author:   CodeBot

Google
 
Web ureader.com


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