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_ROOTCLSID{DAE49F45-660D-11D3-BB7C-444553540000}]
@="Root"

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

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

[HKEY_LOCAL_MACHINESoftwareMicrosoftWindowsCurrentVersionExplorer
MyComputerNamespace{DAE49F45-660D-11D3-BB7C-444553540000}]
@ = "Nothing Special Namespace Extension"

HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsNTCurrentVersion
ShellExtensionsApproved]
"{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_ROOTDemoSpace.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 under the Desktop. This is as simple as changing My Computer to Desktop in the registry script. If you do this, you might also want to change the attributes to A0000020. This value is the result of ORing together SFGAO_FOLDER, SFGAO_HASSUBFOLDERS, and SFGAO_CANDELETE. When you add a namespace extension under the Desktop, an icon is added to the Desktop. By adding the SFGAO_CANDELETE attribute, the Delete command is available from the context menu of the namespace extension. Otherwise, it would be impossible to remove the icon from the Desktop.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.23.101.63