Adding an explorer bar to IE

From NSIS Wiki
Jump to navigationJump to search
Author: beradrian (talk, contrib)


Description

These macros below add or remove explorer bars to Internet Explorer. You have to restart Internet Explorer in order to work. Tested only on Windows XP SP2.

The explorer bars visibility can be toggled from the View/Explorer Bar menu.

How To Use

${IEExplorerBar_Add} `GUID` `Title` `Orientation` `Url` `DefaultBarSize`
GUID
Your application GUID. If you don't have one, use the function from Create a GUID, a Globally Unique Identifier page.
Title
Title of the item to appear as the menu item label.
Orientation
The explorer bar orientation. The possible values are ${EXPLORER_BAR_HORIZONTAL} for horizontal bars and ${EXPLORER_BAR_VERTICAL} for vertical ones.
Url
The URL of the page to be opened in the explorer bar window.
DefaultBarSize
The default bar size in pixels.
${IEExplorerBar_Remove} `GUID`
GUID
Your application GUID used on ${IEExplorerBar_Add}.

The Macros

!define EXPLORER_BAR_HORIZONTAL {00021494-0000-0000-C000-000000000046}
!define EXPLORER_BAR_VERTICAL {00021493-0000-0000-C000-000000000046}
 
!define IEExplorerBar_Add `!insertmacro IEExplorerBar_Add`
!macro IEExplorerBar_Add `GUID` `Title` `Orientation` `Url` `DefaultBarSize`
    WriteRegStr HKCR `CLSID\${GUID}` `` `${Title}`
 
    WriteRegStr HKCR `CLSID\${GUID}\Implemented Categories\${Orientation}` `` ``
    ; for HTML pages
    WriteRegStr HKCR `CLSID\${GUID}\Instance` `CLSID` `{4D5C8C2A-D075-11d0-B416-00C04FB90376}`
    WriteRegStr HKCR `CLSID\${GUID}\Instance\InitPropertyBag` `Url` `${Url}` 
    WriteRegStr HKCR `CLSID\${GUID}\InProcServer32` `` `Shdocvw.dll`
 
    WriteRegStr HKCR `CLSID\${GUID}\InProcServer32` `ThreadingModel` `Apartment`
 
    WriteRegDWORD HKCU `Software\Microsoft\Internet Explorer\Explorer Bars\${GUID}` `BarSize` `${DefaultBarSize}`
!macroend
 
!define IEExplorerBar_Remove `!insertmacro IEExplorerBar_Remove`
!macro IEExplorerBar_Remove `GUID`
    DeleteRegKey HKCR `CLSID\${GUID}`
    DeleteRegKey HKCU `Software\Microsoft\Internet Explorer\Explorer Bars\${GUID}`
!macroend

Written by beradrian.