Here is some more Info:
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:
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:
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;
}
return NULL;
}
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/...ntextmenu.aspx