|
|
|
|
|
|
|
|
|
Quick Info
Windows NT
| Yes
| Win95
| Yes
| Win32s
| No
| Import Library
| -
| Header File
| shlobj.h
| Unicode
| No
| Platform Notes
| None
|
|
|
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
0x0002
| Copies the file specified by pszSrcFile to the location specified by pszDestFile.
| FO_DELETE
0x0003
| Deletes the file specified by pszSrcFile.
| FO_MOVE
0x0001
| Moves the file specified by pszSrcFile to the location specified by pszDestFile.
| FO_RENAME
0x0004
| Renames the file specified by pszSrcFile.
| PO_DELETE
0x0013
| Deletes the printer specified by pszSrcFile.
| PO_PORTCHANGE
0x0020
| 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
0x0014
| Renames the printer specified by pszSrcFile.
| PO_REN_PORT
0x0034
| 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
0x0040
| Preserves undo information (when possible).
| FOF_CONFIRMMOUSE
0x0002
| Not implemented.
| FOF_FILESONLY
0x0080
| Not implemented. The shell calls a copy hook handler only for folder objects,
not files.
| FOF_MULTIDESTFILES
0x0001
| The SHFileOperation function specified multiple destination files (one for each source file)
rather than one directory where all the source files are to be deposited. A copy
hook handler typically ignores this value.
| FOF_NOCONFIRMATION
0x0010
| Responds with "yes to all" for any dialog box that is displayed.
| FOF_NOCONFIRMMKDIR
0x0200
| Does not confirm the creation of any needed directories if the operation
requires a new directory to be created.
| FOF_RENAMEONCOLLISION
0x0008
| 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
0x0004
| Displays no progress dialog box.
| FOF_SIMPLEPROGRESS
0x0100
| 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
ICopyHook, SHFileOperation
Related Links
Software for Delphi and C++ Builder developers
Software for Visual Studio .NET developers
Software for Visual Basic 6 developers
Delphi Tips&Tricks
MegaDetailed.NET
More Online Helps
Win32 Multimedia Programmer's Reference (mmedia.hlp)
OLE Programmer's Reference (ole.hlp)
Microsoft Windows Pen API Programmer's Reference (penapi.hlp)
Microsoft Windows Sockets 2 Reference (sock2.hlp)
Microsoft Windows Telephony API (TAPI) Programmer's Reference (tapi.hlp)
Unix Manual Pages
|