I have a namespace extension that uses both SHCreateShellFolderView
and SHCreateDefaultContextMenu
. I also use IShellFolderViewCB
and IContextMenuCB
to create default objects. Most of the expected functionality is working. For example: I can double-click on “folder” items to browse into them, and double-click on “non-folder” items to get an app to launch against the supplied path.
Both of my IShellFolder
“folder” and “non-folder” objects have:
dwAttributes |= SFGAO_FILESYSTEM;
dwAttributes |= SFGAO_HASPROPSHEET;
dwAttributes |= SFGAO_CANCOPY;
dwAttributes |= SFGAO_CANMOVE;
dwAttributes |= SFGAO_CANLINK;
dwAttributes |= SFGAO_CANRENAME;
dwAttributes |= SFGAO_CANDELETE;
Each of my IShellFolder
“folder” (directory) objects additionally have:
dwAttributes |= SFGAO_STORAGEANCESTOR;
dwAttributes |= SFGAO_STORAGE;
dwAttributes |= SFGAO_FILESYSANCESTOR;
dwAttributes |= SFGAO_FOLDER;
dwAttributes |= SFGAO_BROWSABLE;
dwAttributes |= SFGAO_HASSUBFOLDER;
dwAttributes |= SFGAO_DROPTARGET;
In both cases, I do the proper:
*pdwAttributes &= dwAttributes;
When I right-click on one of the “folder” objects listed in CDefView
, to bring-up the context menu for that folder, I can clearly see Paste
enabled (dark, not greyed).
When I click in the blank background area of CDefView
, to bring-up the context menu for the folder that corresponds to the blank space (not any of the listed items), that is, the folder of the tree control that created the view, Paste
and Paste shortcut
are present, but are always greyed-out, no matter what is on the Clipboard.
I tried the following to get Paste
and Paste
shortcut to stop being greyed:
- Tweak the
SFGAO_*
flags. - Disable the invocation of
IContextMenuCB::Callback
. - Disable the invocation of
IShellFolderViewCB::MessageSFVCB
. - Tweak the associations for the
IContextmenu
generated inIShellFolver::CreateViewObject
.
What is necessary to get Paste
and Paste shortcut
to stop being greyed for the background context menu in CDefView
?