As promised, this is the first in what will be a few articles about some of the pitfalls involved in writing IE add-ons, based on my own experience in writing Find As You Type for Internet Explorer. This isn't meant to be a tutorial or a definitive guide to writing add-ons; it's assumed you have at least some knowledge on how to do this. For a review of the basics, you can check this article on MSDN.
A list of the articles in this series is available here.
The first item I will cover is visual styles. Suppose you were to write you own add-on based on the guide at the link above, or even if you just compile the samples from MSDN or CodeProject or similar, and then run them. You will soon notice that your toolbar or explorer bar doesn't use the Windows XP theme (or the Vista theme on Vista), or visual style. Instead it will use the Windows Classic look. Here's what the Find As You Type toolbar looks like without visual styles:
As you can see, this looks quite out of place, because the rest of Internet Explorer is using the proper theme.
So how to go about fixing this. Unfortunately, the answer to that is quite hard to find. Some casual googling will not reveal it (although it can be found that way, but it's quite buried). Of course it's my hope that if you googled this problem, you ended up on this page. :)
Fortunately, once you know the answer, it's quite simple to actually do it. The answer is described in Microsoft Knowledge Base article 830033, which, although it says it's about Office add-ons, it also applies to Internet Explorer add-ons.
As it turns out, you must add a special manifest resource to your application. This is quite similar to how you'd make any application support visual styles. The difference is that, instead of the normal CREATEPROCESS_MANIFEST_RESOURCE_ID, you must use the ISOLATIONAWARE_MANIFEST_RESOURCE_ID.
Note that if you are using Visual Studio 2005, you don't actually need to create (or modify) a resource file like it specifies in the article. You can simply add the manifest file to your Visual C++ Win32 DLL project, and it will be embedded automatically. For DLL projects, Visual Studio 2005 automatically uses the ISOLATIONAWARE_MANIFEST_RESOURCE_ID to do this. After this is done, Find As You Type looks like this.
And that, of course, looks much nicer. There remains one problem that I do not yet know how to solve. If you open any windows from your add-on, for instance using the Win32 MessageBox or DialogBox function, they will still not have visual styles. Considering that even Microsoft's own Internet Explorer Developer Toolbar suffers from this problem, I don't know if there even is a solution for that. But if anyone knows how, I'd appreciate it if they'd let me know.
That concludes my first IE add-on article. Next time, we'll look at how to handle messages if you're writing a toolbar.