Support
Joined: 18 Jul 2005 Posts: 731
|
Posted: Mon Nov 06, 2006 8:59 am Post subject: HOWTO : Make a IE toolband/bandobject visible by default when IE starts up |
|
|
To make a IE toolband or a horizontal/vertical bandobject visible by default when IE starts up, use a BrowserHelperObject. Add a new BrowserHelperObject to your project (Project-->Add New item-->EZShellExtensions.Net-->BrowserHelperObject) and in the OnLoad method, use the following code :
[C#]
object o = this.GetWebBrowser();
if(o!=null)
{
SHDocVw.WebBrowserClass wbc = (SHDocVw.WebBrowserClass)Marshal.CreateWrapperOfType(o,typeof(SHDocVw.WebBrowserClass));
object guid = "{<<GUID of your explorer bar>>}"; // eg : "{BDB85E7A-CF09-45b4-B6CA-20C0633C8A8B}"
object show=true;
object nullobj = null;
wbc.ShowBrowserBar(ref guid,ref show,ref nullobj);
}
[VB.Net]
Dim o As Object = Me.GetWebBrowser()
If (o Is Nothing = False) Then
Dim wbc As SHDocVw.WebBrowserClass = CType(Marshal.CreateWrapperOfType(o, GetType(SHDocVw.WebBrowserClass)), SHDocVw.WebBrowserClass)
Dim guid as Object = "{<<GUID of your explorer bar>>}" ' eg : "{BDB85E7A-CF09-45b4-B6CA-20C0633C8A8B}"
Dim show as Object =true
Dim nullobj as Object = null
wbc.ShowBrowserBar(guid,show,nullobj)
Note
Your project must add a reference to "Microsoft Internet Controls" (ShDocVw.dll) from the
COM tab of the 'Add Reference..' dialog box. The interop assembly file generated - "Interop.ShDocVw.dll" - should be given a strong name and be placed in the GAC. To give a strong name to the file, goto project properties and specify a key file/ key name in the 'Wrapper Assembly For ActiveX/COM objects heading.
Alternatively, you can use the "Interop.ShDocVw.dll" that comes with EZShellExtensions.Net; it is located in the install path (typically C:\Program Files\LogicNP Software\EZShellExtensions.Net 2.0). |
|