Game Development Reference
In-Depth Information
First, you must register the extension assembly as a COM component. When using
a standalone extension assembly, you can do this with the regasm.exe command.
Open the Visual Studio command prompt and execute:
Regasm.exe NameOfYourExtension.dll
This tool creates all the necessary entries to configure the assembly as a COM
object. With the assembly correctly configured for COM, we now need to register
the object as a shell extension. This is done with Win32 registry entries, and the
code for this is in the RegisterExtension() method within ShellExtensionBase .
Remember the RegisterServer() method that was decorated with
ComRegisterFunctionAttribute ? Regasm will call this static method automatically
when executed, which is where we then call RegisterExtension() to configure the
registry appropriately. Conveniently, there is also a method for unregistration that
calls UnregisterExtension() .
After the object has been successfully configured as a shell extension, the Win32
registry will have new entries for each of the configured file extensions pointing to
the extension class. Figure 41.1 shows the extension registered for an .nxw file.
Figure 41.1 Registry key added for shell extension association.
Extensions that have been integrated with an existing managed tool are typically
in the form of an executable, which will not be successfully registered with Regasm .
To get around this, we simply use the RegistrationServices class of the COM
interop layer, which essentially calls the same functionality that Regasm does, except
programmatically.
You can register the extension integrated in our test console application by exe-
cuting:
SimpleTool.exe /r
Search Nedrilad ::




Custom Search