Microsoft KB Archive/183860

{|
 * width="100%"|

HOWTO: Support Dropping of Items on Your Namespace Root

 * }

Q183860

-

The information in this article applies to:


 * Microsoft Win32 Software Development Kit (SDK)

-

SUMMARY
Certain types of namespace extensions might require that you be able to drop dragged items on the root of the namespace. For example, a namespace extension that is on the desktop and you need to enable the user to drop items in the extension's desktop icon. The Recycle Bin is an example of a namespace extension that allows this. Because the root of a namespace is not an item within the namespace, you need to support this in a slightly different manner.

This article assumes you are already familiar with development of namespace extensions. For more information on writing namespace extensions, see the articles listed in the REFERENCES section of this article.

MORE INFORMATION
When a user drags an item over a folder object within a namespace, the shell calls the folder parent's IShellFolder::GetAttributesOf, passing the PIDL for the child folder, to see if that folder has the SFGAO_DROPTARGET attribute. If that item has this attribute, the shell then calls the folder parent's IShellFolder::GetUIObjectOf, passing IID_IDropTarget. When an item is dragged over the root of a namespace, the shell must take a different route because the root of the namespace is an item in the shell's namespace, not an item in the extension's namespace.

When a user drags an item over the root of a namespace, the shell retrieves the namespace extension's attributes from the registry in the Attributes value under the HKEY_CLASSES_ROOT - CLSID -  - ShellFolder key. If this value contains SFGAO_DROPTARGET, the shell knows that this item supports dropping of items. The shell then instantiates and initializes the shell folder object. Once this is complete, the shell calls the shell folder object's IShellFolder::CreateViewObject, passing IID_IDropTarget. To support dropping of items onto the root of your namespace, you must create an instance of your IDropTarget implementation and return the interface pointer in response to this call.

The shell uses this same method whether or not your namespace is on the desktop, under My Computer, or created from a junction point.