# BHO (IE Addin/extension) manifest visual styles xp

2006-12-27

Tried to cram as many relevant words in the title for this to come up in Google when people search for it.

Adding visual styles (common control manifest) to a BHO (Browser Helper Object, or in it's other names Browser-Extension/Add-in/Band-Object) is not trivial. Thankfully enough our good friends at MS didn't bother to document this, like a gazillion other things…

**here goes:**

- Copy over a manifest file from some old project or download one from the net, they are all the same, just change the project name inside and then rename your manifest to 'mydllfilename.dll.manifest', so if your extension is 'wagamama.dll' your manifest is 'wagamama.manifest.dll'.
- Right-click your resource root in VS, hit 'Resource includes', then add this to 'Compile-time directives':
  **ISOLATIONAWARE**\_MANIFEST\_RESOURCE\_ID RT\_MANIFEST "&lt;your&gt;"
- Go to stdafx.h or somewhere and:
  **`#define ISOLATION_AWARE_ENABLED    1`**

You're good to go.

But if I really wanna know what's going on, what are the catches?

- you use **ISOLATIONAWARE**\_MANIFEST\_RESOURCE\_ID instead of **CREATEPROCESS**\_MANIFEST\_RESOURCE\_ID
- you need to define `ISOLATION_AWARE_ENABLED` and set it to 1 or something, if you just define it you get a compile error because of how MS write their code, just look at this:
  winnt.h (line 9153):
  `#if (_WIN32_WINNT > 0x0500) || (_WIN32_FUSION >= 0x0100) || ISOLATION_AWARE_ENABLED // winnt_only`
  doesn't that compile wonderfully… you guessed right, when MS bothers to talk about this directive they just tell you to define it, they never expected somebody not to define `_WIN32_WINNT` to something lower than 0x0500 (xp ?)… so they basically wrote code that never evaluates, ain't that funny….

More (incomplete) info on this can be found:
http://support.microsoft.com/default.aspx?scid=kb;en-us;830033
http://www.ookii.org/showpost.aspx?post=12
