given InternetExplorer object, how do you get it's text in titlebar?

S

sean_n

The following code below loops through all InternetExplorer objects
and sets the TitleBar to 0--thus hiding all the toolbars. What I
really want is to hide the toolbar only if the text in the titlebar is
set to something. Given InternetExplorer object, how do you get it's
text in the titlebar?

using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using SHDocVw;
using Shell32;

namespace hidetoolbar
{
class Program
{
//These are class data members
static private SHDocVw.InternetExplorer m_IExplorer = null;
static private IWebBrowserApp m_WebBrowser = null;

public static void Main(string[] args)
{
ShellClass shell = new Shell32.ShellClass();
ShellWindows ies = (ShellWindows)shell.Windows(); //IE
windows.
InternetExplorer ie;
for (int i = 0; i < ies.Count; i++)
{
ie = (InternetExplorer) ies.Item(i);
//
// Need to find a way to check the Titlebar text
//
ie.ToolBar = 0;
}
}
}
}
 
S

sean_n

You can case the IE object to an IWebBrowserApp, then use the
LocationName property. Seems like the LocationName is the same text
in the Titlebar.

m_WebBrowser = (IWebBrowserApp)ie;
if (m_WebBrowser != null)
{
if (m_WebBrowser.LocationName.Contains(args[0]))
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top