Windows Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > WinFX General

Programmatically Read All URL's in All Tabs in a Browser?

Update your Vista Drivers Update Your Drivers Now!!
 
 
Thread Tools Display Modes
Old 01-31-2008   #1 (permalink)
Wes Williams
Guest


 

Programmatically Read All URL's in All Tabs in a Browser?

How can I approach capturing all the open URL's in all tabs in my open browser?

I wrote C# code to capture all of the IE processes but I cannot get into the
browser object model from there. How do I get into the object model and get
the URL in the address bar in all tabs?

Process[] myProcesses = Process.GetProcesses();
foreach (Process myProcess in myProcesses)
{
if (myProcess.ProcessName.Equals("IExplore",
StringComparison.CurrentCultureIgnoreCase))
Console.Write(myProcess.ProcessName);
}

--
Thanks,
Wes

My System SpecsSystem Spec
Old 01-31-2008   #2 (permalink)
Wes Williams
Guest


 

RE: Programmatically Read All URL's in All Tabs in a Browser?

Okay everyone. Did lot's of digging to get this one and the Google references
to code are not helpful. Bookmark this one. Here's the code to do it:

using SHDocVw;
using mshtml;

....
listProcesses.Items.Clear();

ShellWindows SW = new ShellWindowsClass();
string processName;
HTMLDocumentClass htmlDoc;

foreach (InternetExplorer IE in SW)
{
processName =
System.IO.Path.GetFileNameWithoutExtension(IE.FullName).ToLower();
if (processName.Equals("iexplore"))
{
try
{
htmlDoc = (HTMLDocumentClass)IE.Document;

listProcesses.Items.Add(htmlDoc.IHTMLDocument2_nameProp + " - " +
htmlDoc.IHTMLDocument2_url);
}
// when the browser does not hold an html doc
catch (InvalidCastException ex)
{
}
}
}

--
Wes Williams


"Wes Williams" wrote:
Quote:

> How can I approach capturing all the open URL's in all tabs in my open browser?
>
> I wrote C# code to capture all of the IE processes but I cannot get into the
> browser object model from there. How do I get into the object model and get
> the URL in the address bar in all tabs?
>
> Process[] myProcesses = Process.GetProcesses();
> foreach (Process myProcess in myProcesses)
> {
> if (myProcess.ProcessName.Equals("IExplore",
> StringComparison.CurrentCultureIgnoreCase))
> Console.Write(myProcess.ProcessName);
> }
>
> --
> Thanks,
> Wes
My System SpecsSystem Spec
 

Thread Tools
Display Modes



Similar Threads
Thread Thread Starter Forum Replies Last Post
RE: Corrupt URL's Jeff Pipe Vista file management 0 01-28-2008 05:50 AM
Re: Corrupt URL's Chang Yin Vista file management 0 01-03-2008 05:05 AM
HomePage Tabs >Why is it limited to 8 tabs ??? Vista General 3 11-06-2007 07:45 PM
7 tabs opening in browser Ron Vista mail 5 09-17-2007 11:28 PM
Programmatically change default web browser joseph.wambelumbo Vista General 0 08-30-2007 02:39 AM


Update your Vista Drivers Update Your Vista Drivers Now!!

Vistax64.com is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media 2005-2008