O'Reilly logo

VB Shell Programming by J.P. Hamilton

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating an Icon Handler

Our icon handler is going to be very impractical, but it is going to be a great example. We are going to create icons for several animal types, including dogs, cats, fish, cows, and armadillos. There will also be an icon representing an unknown animal. Our icon handler will allow us to determine which animal we are dealing with and display the appropriate icon in the shell. The icons will be stored in a resource file that we will include in the server. Each animal will have a 16 × 16 icon that will be displayed by the shell for the file object and a 32 × 32 icon that is used by the Property Page for the file. We have a little bit of work to do, so let’s get started.

We aren’t going to create a new project for the icon handler (although you may if you wish). We are simply going to continue with the project we started in Chapter 4. This brings up an interesting point. Our server can contain as many objects as we wish. There doesn’t have to be a one-to-one relationship between the COM server and the server object (in this case a shell extension). In fact, every shell extension we create in the book will reside in one COM server. Each shell extension in the book will have its own class. But you don’t have to implement separate classes, either. You could have just one class with all the appropriate interfaces implemented inside of it to support multiple shell extensions. It would be gargantuan and hard to get around in, but you could do it!

Let’s begin the project ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required