Monday, February 01, 2010

How to ensure your IE toolbar buttons are always visible?

Some time ago I encountered a wall while developing add-on for Internet Explorer. I wanted my add-on's button to be always visible after installation process, similarly to delicious stuff.

Problem seems to be quite simple - just check Browser Helper Object's (BHO) options and set some flag (aside of this subject I will tell you that developing pure BHO is a nightmare). In fact there is no such option. Internet Explorer seemed not extensible to this extent. Also finding something in the Internet appeared to be impossible. What the hell? Delicious guys made it!

After quite long searching I was very close to give up and resign from this "feature". But my sixth sense (yes, you should use it a lot while working with Microsoft) was telling me - "check the registry". So I did, and it was a bull's eye shot.

The thing you have to do is to increase the width of Tool Band Width of Internet Explorer (my NSIS script contains this):
WriteRegDWORD HKCU "Software\Microsoft\Internet Explorer\CommandBar" "ToolBandWidth" 800
It's very very primitive but it's the only solution I found to work. You just have to provide the desired width in pixels (decimal value) you'd like IE toolbar to be. Don't worry - you can put there even a value of 3000 - IE is smart enough not to extend the toolbar more than needed i.e. if you put a value of 1000 and your buttons need only 500 pixels IE will automatically adjust toolbar width to 500px.

This solution works but has also a big disadvantage. As you can see I write information to the registry for HKCU (HKEY_CURRENT_USER), so if you are installing the add-on with user Administrator, only this user will have Tool Band enlarged. If you open IE with another user she will probably not see your add-on button(s) (applies to IE7 and IE8).

Until now I couldn't find a better way - did you?

No comments: