Registering Copy Hook Handlers

Copy hook handlers are registered in two locations, depending on whether they are for shell folders or printer objects.

If the handler is for a shell folder, it is registered like so:

HKEY_CLASSES_ROOT\
    Directory\
        shellex\
            CopyHookHandlers\
                {Copy Hook Name} = {CSLID}

If the handler is for a printer object, it is registered in the following location:

HKEY_CLASSES_ROOT\
    Printers\
        shellex\
            CopyHookHandlers\
                {Copy Hook Name} = {CSLID}

{Copy Hook Name} can be any name that you wish, and {CLSID } is, of course, the class identifier of the copy hook handler.

Also, both types of copy hook handlers need to be registered as approved shell extensions at the following location:

HKEY_LOCAL_MACHINE\
    Software\
        Microsoft\
            Windows\
                CurrentVersion\
                    Shell Extensions\
                        Approved = {CLSID}

Example 9.3 contains the registry script that will register the copy hook handler developed in this chapter under the Directory key. Remember, when entering registry scripts, lines enclosed in square brackets must be on one line:

REGEDIT4

[HKEY_CLASSES_ROOT\Directory\shellex\CopyHookHandlers\RadCopyHook]
@ = "{FAE14EFA-03DA-11D3-BB7C-444553540000}"

[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Shell Extensions\Approved]
"{FAE14EFA-03DA-11D3-BB7C-444553540000}" = "RAD Copy Hook"

Get VB Shell Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.