ICopyHookICopyHook*
*Contents  *Index  *Topic Contents
*Previous Topic: IContextMenu3::HandleMenuMsg2
*Next Topic: ICopyHook::CopyCallback

ICopyHook


ICopyHook is a COM-based interface used to create a copy hook handler. A copy hook handler is a shell extension that determines if a shell folder or printer object can be moved, copied, renamed, or deleted. The shell calls the ICopyHook::CopyCallback method prior to performing one of these operations.

The copy hook handler, which is an OLE in-process server (a DLL), does not perform the task itself, but it does approve or disapprove the action. If the shell receives approval from the copy hook handler, it performs the file system operation. Copy hook handlers are not informed about the success of an operation, so they cannot monitor actions taken on folder objects unless FindFirstChangeNotification is used.

A folder object can have multiple copy hook handlers. For example, even if the shell already has a copy hook handler registered for a particular folder object, you can still register one of your own. If two or more copy hook handlers are registered for an object, the shell simply calls each of them before performing one of the specified file system operations.

The shell initializes ICopyHook directly, without using the IShellExtInit interface first.

CopyCallback returns an integer value that indicates whether or not the shell should perform the operation. The shell will call each copy hook handler registered for a folder object until all the handlers have been called or until one of them has returned a value other than IDYES. The handler returns IDYES to specify that the operation should be performed, or IDNO or IDCANCEL to specify that the operation should be discontinued.

When to Implement

Implement a copy hook handler when you want to be able to control when, or if, these file system operations are performed on a given object. You might want to use a copy hook handler on shared folders, for example.

When to Use

You do not call this shell extension directly. ICopyHook::CopyCallback is called by the shell prior to moving, copying, deleting, or renaming a shell folder object.
ICopyHook Method Description
CopyCallback Determines whether a move, copy, delete, or rename operation on a folder object should be allowed or disallowed.


Up Top of Page
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.