Copy Hook Handler Interface: ICopyHook
Now that we are somewhat familiar with copy
hook handlers, let’s talk about ICopyHook.
This interface is the only interface a copy hook handler needs to
implement. It contains one method, CopyCallback.
Don’t let the simplicity fool you, though. Implementing a copy
hook handler is much more difficult than it seems at first glance (as
you will soon see). As Table 9.1 shows,
ICopyHook contains one method called
CopyCallback. This is the only method ever called
on a copy hook handler.
Table 9-1. ICopyHook
|
Method |
Description |
|---|---|
|
|
Determines whether the shell will be allowed to move, copy, delete, or rename a folder or printer object. |
The
syntax of the CopyCallback method is as follows:
UINT CopyCallback(
HWNDhwnd,
UINT wFunc,
UINT wFlags,
LPCSTR pszSrcFile,
DWORD dwSrcAttribs,
LPCSTR pszDestFile,
DWORD dwDestAttribs
);Table 9.2 lists the parameters that the shell passes to the copy hook handler and their meaning.
Table 9-2. CopyCallback Parameters
|
Parameter |
Datatype |
Description |
|---|---|---|
|
|
|
Handle to a window that the copy hook handler should use to display any user-interface elements. |
|
|
|
Operation to be performed (see Table 9.3). |
|
|
|
This value can be ignored for copy hook handlers. |
|
|
|
Address of a string that contains the name of the source folder or printer. |
|
|
|
Attributes of the source folder or printer (see Table 9.3). |
|
|
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access