Search code examples
c#internet-explorerbhobrowser-extensionprotected-mode

Custom icon for IE9 Toolbar buttons


I made an extension for IE9 that adds a toolbar button.

The registration looks like this:

RegistryKey registryKey = Registry.LocalMachine.OpenSubKey(RegCmd, true);
if (registryKey == null)
   registryKey = Registry.LocalMachine.CreateSubKey(RegCmd);
RegistryKey key = registryKey.OpenSubKey(guid);
if (key == null)
  key = registryKey.CreateSubKey(guid);
key.SetValue("ButtonText", "My Button");
key.SetValue("CLSID", "{1FBA04EE-3024-11d2-8F1F-0000F87ABD16}");
key.SetValue("ClsidExtension", guid);
key.SetValue("Icon", "c:\myicon.ico");
key.SetValue("HotIcon", "c:\myicon.ico");
key.SetValue("Default Visible", "Yes");
key.SetValue("MenuText", "My Button");
key.SetValue("ToolTip", "My Button");
//key.SetValue("KeyPath", "no"); 
registryKey.Close();
key.Close();

The problem is - the icons are referenced as files on a file system, rather than URLs. IE Gallery distributes plugins as .dll's not .msi's so I have no opportunity to place my .ico onto the local file system.

How can I make the button use my icon?


Solution

  • You should be able to add your icon to the DLL and use mydll.dll,0 or something similar as the icon.