ICopyHook::CopyCallback
[Now
Supported on Windows NT]
Either allows
the shell to move, copy, delete, or rename a folder or printer object, or
disallows the shell from carrying out the operation. The shell calls each copy
hook handler registered (see Comments below) for a folder or printer object
until either all the handlers have been called or one of them returns IDCANCEL.
UINT CopyCallback(
HWND hwnd, |
//Handle of
the parent window for displaying UI objects |
UINT
wFunc, |
//Operation
to perform. |
UINT wFlags, |
//Flags
that control the operation |
LPCSTR pszSrcFile, |
//Pointer
to the source file |
DWORD dwSrcAttribs, |
//Source
file attributes |
LPCSTR pszDestFile, |
//Pointer
to the destination file |
DWORD dwDestAttribs |
//Destination
file attributes |
); |
|
Parameters
hwnd
Handle of the
window that the copy hook handler should use as the parent window for any user
interface elements the handler may need to display. If FOF_SILENT is specified,
the method should ignore this parameter.
wFunc
Operation to
perform. This parameter can be one of the following values:
FO_COPY |
Copies the
file specified by pszSrcFile to the location specified by pszDestFile. |
FO_DELETE |
Deletes the
file specified by pszSrcFile. |
FO_MOVE |
Moves the
file specified by pszSrcFile to the location specified by pszDestFile. |
FO_RENAME |
Renames the
file specified by pszSrcFile. |
PO_DELETE |
Deletes the
printer specified by pszSrcFile. |
PO_PORTCHANGE |
Changes the
printer port. The pszSrcFile and pszDestFile parameters contain
double null-terminated lists of strings. Each list contains the printer name
followed by the port name. The port name in pszSrcFile is the current
printer port, and the port name in pszDestFile is the new printer
port. |
PO_RENAME |
Renames the
printer specified by pszSrcFile. |
PO_REN_PORT |
Combination
of PO_RENAME and PO_PORTCHANGE. |
wFlags
Flags that
control the operation. This parameter can be a combination of the following
values:
FOF_ALLOWUNDO |
Preserves
undo information (when possible). |
FOF_CONFIRMMOUSE |
Not
implemented. |
FOF_FILESONLY |
Not
implemented. The shell calls a copy hook handler only for folder objects, not
files. |
FOF_MULTIDESTFILES |
The SHFileOperation |
FOF_NOCONFIRMATION |
Responds
with yes to all for any dialog box that is displayed. |
FOF_NOCONFIRMMKDIR |
Does not
confirm the creation of any needed directories if the operation requires a
new directory to be created. |
FOF_RENAMEONCOLLISION |
Gives the
file being operated on a new name, such as, Copy #1 of ... , in a copy,
move, or rename operation when a file with the target name already exists. |
FOF_SILENT |
Displays no
progress dialog box. |
FOF_SIMPLEPROGRESS |
Displays a
progress dialog box, but the dialog box does not show the names of the files. |
pszSrcFile
Pointer to a
string that contains the name of the source file.
dwSrcAttribs
Attributes of
the source file. This parameter can be a combination of any of the file
attribute flags (FILE_ATTRIBUTE_*) defined in the Windows header files.
pszDestFile
Pointer to a
string that contains the name of the destination file.
dwDestAttribs
Attributes of
the destination file. This parameter can be a combination of any of the file
attribute flags (FILE_ATTRIBUTE_*) defined in the Windows header files.
Return Value
Returns an
integer value that indicates whether or not the shell should perform the
operation. It can be one of the following:
IDYES
Allows the
operation.
IDNO
Prevents the
operation on this file, but continues with any other operations (for example, a
batch copy operation).
IDCANCEL
Prevents the
current operation and cancels any pending operations.
Comments
You need to
register your copyhook handler. For example, \directory copyhook handlers are registered
under HKEY_CLASSES_ROOT\directory\shellex\CopyHookHandlers\your_copyhook\{ copyhook
CLSID value}. Other registry keys associated with shell extensions are: *,
Folder, Drives, Printers, Unknown, and AudioCD.
The shell
initializes the ICopyHook interface
directly, when ICopyHook::CopyCallback is called, without using an IShellExtInit or IPersistFile interface first.
See Also