11.8 Practical Coding Examples

only for RuBoard - do not distribute or recompile

11.8 Practical Coding Examples

Writing a namespace extension is a pretty big undertaking, and most of the code in a namespace extension is specific to the extension itself. This is due to the fact that PIDLs are different for every extension. As it turns out, a majority of the code in a practical namespace extension involves managing a PIDL in one way or another. Therefore, we did things a little differently in this chapter: the example code for this chapter was not designed to be practical in any sense of the word. Rather, it was designed to be simple so we could focus on how to implement a namespace rather than have to wade through large volumes of proprietary code.

However, once you've worked through this generic example of implementing a namespace extension, you'll want to take a careful look at the downloadable code samples, which contain two "real world" namespace extensions: RegSpace, which allows you to browse the keys and value entries of the registry as if they were part of the filesystem, and ROTSpace, which similarly presents the Running Object Table (ROT) as a part of the shell namespace.

11.8.1 RegSpace

The first is based on the RegView example (a namespace extension implemented in C++) in the MSDN library. As you might be able to guess from the name , this extension provides a view of the registry from within Explorer. The VB version of RegView, which we'll call RegSpace, can be seen in action in Figure 11.9. RegSpace is an example of a namespace extension with a fairly complex hierarchy.

Figure 11.9. RegSpace

11.8.2 ROTSpace

The second extension, ROTSpace, is a view of the ROT . The ROT is a globally accessible table that keeps track of all running COM objects that can be identified with a moniker. A moniker acts like a name that uniquely identifies a COM object much in the same way that a path identifies a file in the filesystem. IMoniker is what makes a moniker a moniker, and the interesting thing about monikers is that they support what is known as binding. Binding means locating an object named by the moniker, activating it, and returning a pointer to a requested interface on the object. What's even more interesting is that if the moniker is already running, you can attach to the running instance (but we're not going to talk about that). ROTSpace is shown in Figure 11.10.

Figure 11.10. ROTSpace
only for RuBoard - do not distribute or recompile

Visual Basic Shell Programming
Visual Basic Shell Programming
ISBN: B00007FY99
Year: 2000
Pages: 128

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net