HOWTO: Support Dropping of Items on Your Namespace Root

ID: Q183860


The information in this article applies to:
  • Microsoft Win32 Software Development Kit (SDK)
  • Microsoft Windows 2000


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 - <CLSID of extension> - 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.


REFERENCES

"Microsoft Systems Journal 1996 Volume 11," July 1996 Number 7, "Extending the Windows Explorer with Name Space Extensions," David Campbell

For additional information, please see the following article in the Microsoft Knowledge Base:

Q178665 SAMPLE: RegView.exe Contains Shell Namespace Extension Example

Additional query words:

Keywords : kbExtension kbNameSpace kbNTOS400 kbWinOS2000 kbSDKWin32 kbWinOS95 kbWinOS98 kbshell kbGrpShell
Version : WINDOWS:
Platform : WINDOWS
Issue type : kbhowto


Last Reviewed: January 25, 2000
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.