Paste and Paste shortcut Greyed-Out In Context Menu Of Background of Default IShellView
See the question and my original answer on StackOverflowThe "Folder View" is one of Windows Explorer five basic components:
When one right-clicks on one item (or multiple selected items) in this Folder View (or on items in the Tree View), the Shell will call IShellFolder::GetUIObjectOf for various interfaces and passes the PIDL(s) of the selected item(s).
When one right-clicks on the Folder View where there's no item, it will call IShellFolder::CreateViewObject for various interfaces, since there's no PIDL to use, as it's about the shown folder itself.
This is true for IContextMenu
for the right-click context menu, as well as other interfaces, such as IDropTarget which is used in Drag&Drop and also Copy/Paste operations.
And for IDropTarget
to be asked, the Shell Folder must expose the SFGAO_DROPTARGET "The specified items are drop targets" attribute.
I have created an Shell Namespace Extension sample here https://github.com/smourier/ExplorerDataProvider based on Microsoft's official one, that demonstrates (limited) IDropTarget
support, enough for the "Paste" menu item to be enabled.
PS: GetUIObjectOf and CreateViewObject can usually share a lot of code, just handling presence of PIDL(s) or absence of PIDL(s) in a common way.