Registering DemoSpace

The last thing we need to do is register the namespace extension. The registry information shown in Example 11.35 will insert our namespace extension under My Computer. Remember, if you type this listing in, everything inside of the square brackets must be on the same line.

Example 11-35. DemoSpace.reg

REGEDIT4

[HKEY_CLASSES_ROOT\CLSID\{DAE49F45-660D-11D3-BB7C-444553540000}]
@="Root"

[HKEY_CLASSES_ROOT\CLSID\{DAE49F45-660D-11D3-BB7C-444553540000}\ShellFolder\]"Attributes"=dword:a0000000

[HKEY_CLASSES_ROOT\CLSID\{DAE49F45-660D-11D3-BB7C-444553540000}\DefaultIcon\]
@="shell32.dll,46"

[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Explorer
\MyComputer\Namespace\{DAE49F45-660D-11D3-BB7C-444553540000}\]
@ = "Nothing Special Namespace Extension"

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsNT\CurrentVersion\
ShellExtensions\Approved\]
"{DAE49F45-660D-11D3-BB7C-444553540000}"="Demo namespace in VB"

The CLSID in the listing is the same CLSID you would find under the HKEY_CLASSES_ROOT\DemoSpace.ShellFolder key. This is important. Everything starts with IShellFolder.

Also, notice the Attributes setting. This value is created by ORing the SFGAO constants (See Example 11.2). The value A0000000 is a result of SFGAO_FOLDER ORed with SFGAO_HASSUBFOLDERS. This attribute is for the junction point of our namespace extension. Without this key, we wouldn’t be able to open our namespace extension at all.

You might also decide that you would like to insert this example ...

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.